/*****************************************************************************
*  Copyright Statement:
*  --------------------
*  This software is protected by Copyright and the information contained
*  herein is confidential. The software may not be copied and the information
*  contained herein may not be used or disclosed except with the written
*  permission of MediaTek Inc. (C) 2005
*
*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
*
*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
 * Filename:
 * ---------
 *  Copter.c
 *
 * Project:
 * --------
 *  Maui
 *
 * Description:
 * ------------
 *  Game Copter function.
 *
 * Author:
 * -------
 * -------
 * -------
 *
 *============================================================================
 *             HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *------------------------------------------------------------------------------
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *============================================================================
 ****************************************************************************/
#include "mmi_features.h"

#include "GameDefs.h"

#if defined(__MMI_GAME_COPTER_SUBMARINE_JET__)

#include "GameInc.h"
#include "CopterProts.h"
#include "mmi_rp_app_games_def.h"

#ifdef __MMI_GAME_MULTI_LANGUAGE_SUPPORT__      //added for multi-language
#include "GameProts.h"
#endif

#ifdef __MMI_TOUCH_SCREEN__
#include "wgui_touch_screen.h"
#endif 

/***************************************************************************** 
* Define
*****************************************************************************/
#if defined(__MMI_MAINLCD_128X160__)
#define MMI_GX_COPTER_GAME_ORIGIN      (32)     /* where the game really is rendered */
#define MMI_GX_COPTER_SCORE_POSITION_X (10)
#define MMI_GX_COPTER_LCD_HEIGHT       (160)
#define MMI_GX_COPTER_LCD_WIDTH        (128)
#define MMI_GX_COPTER_GAME_HEIGHT      (110)
#elif defined(__MMI_MAINLCD_128X128__)
#define MMI_GX_COPTER_GAME_ORIGIN      (17)     /* where the game really is rendered */
#define MMI_GX_COPTER_SCORE_POSITION_X (34)
#define MMI_GX_COPTER_LCD_HEIGHT       (128)
#define MMI_GX_COPTER_LCD_WIDTH        (128)
#define MMI_GX_COPTER_GAME_HEIGHT      (110)
#elif defined(__MMI_MAINLCD_176X220__)
#define MMI_GX_COPTER_GAME_ORIGIN      (44)     /* where the game really is rendered */
#define MMI_GX_COPTER_SCORE_POSITION_X (15)
#define MMI_GX_COPTER_LCD_HEIGHT       (220)
#define MMI_GX_COPTER_LCD_WIDTH        (176)
#define MMI_GX_COPTER_GAME_HEIGHT      (151)
#endif 

#if defined(__MMI_MAINLCD_128X160__)  || defined(__MMI_MAINLCD_128X128__)
#define MMI_GX_COPTER_TITLE_POSITION_X (70)
#define MMI_GX_COPTER_OBSTACLE_WIDTH   (8)
#define MMI_GX_COPTER_OBSTACLE_HEIGHT  (24)
#define MMI_GX_COPTER_OBSTACLE_SPEED   (3)
#define MMI_GX_COPTER_COPTER_HEIGHT    (12)
#define MMI_GX_COPTER_COPTER_WIDTH     (25)
#define MMI_GX_COPTER_COPTER_X         (14)
#define MMI_GX_COPTER_DIGIT_WIDTH      (4)
#elif defined(__MMI_MAINLCD_176X220__)
#define MMI_GX_COPTER_SCORE_POSITION_Y (9)
#define MMI_GX_COPTER_TITLE_POSITION_X (90)
#define MMI_GX_COPTER_OBSTACLE_WIDTH   (11)
#define MMI_GX_COPTER_OBSTACLE_HEIGHT  (33)
#define MMI_GX_COPTER_OBSTACLE_SPEED   (4)
#define MMI_GX_COPTER_COPTER_HEIGHT    (17)
#define MMI_GX_COPTER_COPTER_WIDTH     (35)
#define MMI_GX_COPTER_COPTER_X         (19)
#define MMI_GX_COPTER_DIGIT_WIDTH      (6)
#endif 

#if defined(GDI_USING_LAYER)
#define MMI_GX_COPTER_BACKGROUND_SPEED    (MMI_GX_COPTER_OBSTACLE_SPEED / 2)
#define MMI_GX_COPTER_TRANSPARENT_COLOR   (GDI_COLOR_BLUE)
#define MMI_GX_COPTER_BG_LIST_NUMBER      (4)
#endif /* defined(GDI_USING_LAYER) */ 

#define MMI_GX_COPTER_OBSTACLE_COUNT   (MMI_GX_COPTER_LCD_WIDTH / MMI_GX_COPTER_OBSTACLE_WIDTH + 1)     /* := screen width / obstacle width + 1 */
#define MMI_GX_COPTER_BACK_COLOR       (gui_color(0, 0, 0))
#define MMI_GX_COPTER_BORDER_COLOR     (gui_color(71, 71, 71))
#define MMI_GX_COPTER_LIGHT_BORDER     (gui_color(133, 133, 133))
#define MMI_GX_COPTER_DARK_BORDER      (gui_color(16, 16, 16))

/*
 * Height of elements in screen for 128x160.
 * *  --------------------
 * *  status               (32)           
 * *  --------------------
 * *
 * *  copter space         (110)
 * *
 * *  --------------------
 * *  ground               (18)
 * *  --------------------
 */

/*
 * Height of elements in screen for 128x128.
 * *  --------------------
 * *  status               (17)           
 * *  --------------------
 * *
 * *  copter space         (110)
 * *
 * *  -------------------- (1)
 */

/*
 * Height of elements in screen for 176x220.
 * *  --------------------
 * *  status               (44)           
 * *  --------------------
 * *
 * *  copter space         (151)
 * *
 * *  --------------------
 * *  ground               (25)
 * *  --------------------
 */

#ifdef __MMI_TOUCH_SCREEN__
/* touch screen */
void mmi_copter_pen_down_hdlr(mmi_pen_point_struct pos);
void mmi_copter_pen_up_hdlr(mmi_pen_point_struct pos);
void mmi_copter_pen_repeat_hdlr(mmi_pen_point_struct pos);
#endif /* __MMI_TOUCH_SCREEN__ */ 

/***************************************************************************** 
* MACRO
*****************************************************************************/
#define ERASE_AND_DRAW_OBSTACLES(tmp_node, fill_rect_func, color)                                                    \
{                                                                                                                    \
   tmp_node = g_gx_copter_context.first_obstacle;                                                                    \
   while (1)                                                                                                         \
   {                                                                                                                 \
      /* erase ceiling obstacles */                                                                                  \
      fill_rect_func(   tmp_node->old_position_x,                                                                    \
                        tmp_node->old_position_y,                                                                    \
                        tmp_node->old_position_x + MMI_GX_COPTER_OBSTACLE_WIDTH - 1,                                 \
                        tmp_node->old_position_y + MMI_GX_COPTER_OBSTACLE_HEIGHT - 1,                                \
                        color);                                                                                      \
      /* erase floor obstacles */                                                                                    \
      fill_rect_func(   tmp_node->old_position_x,                                                                    \
                        tmp_node->old_position_y + g_gx_copter_context.space,                                        \
                        tmp_node->old_position_x + MMI_GX_COPTER_OBSTACLE_WIDTH - 1,                                 \
                        tmp_node->old_position_y + 2 * MMI_GX_COPTER_OBSTACLE_HEIGHT + g_gx_copter_context.space - 1,\
                        color);                                                                                      \
      if (tmp_node == g_gx_copter_context.last_obstacle)                                                             \
         break;                                                                                                      \
      tmp_node = tmp_node->next;                                                                                     \
   }                                                                                                                 \
                                                                                                                     \
   /* draw ceiling and floor obstacles */                                                                            \
   tmp_node = g_gx_copter_context.first_obstacle;                                                                    \
   while (1)                                                                                                         \
   {                                                                                                                 \
      /* draw ceiling obstacles */                                                                                   \
      gui_show_image(   tmp_node->position_x,                                                                        \
                              tmp_node->position_y,                                                                  \
                              (PU8)GetImage(IMG_ID_GX_COPTER_OBSTACLE));                                             \
      /* draw floor obstacles */                                                                                     \
      gui_show_image(   tmp_node->position_x,                                                                        \
                              tmp_node->position_y + g_gx_copter_context.space,                                      \
                              (PU8)GetImage(IMG_ID_GX_COPTER_OBSTACLE));                                             \
      if (tmp_node == g_gx_copter_context.last_obstacle)                                                             \
         break;                                                                                                      \
      tmp_node = tmp_node->next;                                                                                     \
   }                                                                                                                 \
}


/************************************************************************/
/* DEBUG                                                      */
/************************************************************************/
U32 g_mmi_copter_start_time;
U32 g_mmi_copter_end_time;
U32 g_mmi_copter_duration;

#define MMI_COPTER_GET_START_TIME(_trace_) \
    do{\
    kal_get_time(&g_mmi_copter_start_time);\
    kal_prompt_trace(MOD_MMI,_trace_, g_mmi_copter_start_time,__LINE__);\
    }while(0)
#define MMI_COPTER_GET_STOP_TIME_AND_PRINT_TRACE(_trace_,_trace2_)\
    do{\
    kal_get_time(&g_mmi_copter_end_time);\
    g_mmi_copter_duration = kal_ticks_to_milli_secs(g_mmi_copter_end_time - g_mmi_copter_start_time);\
    kal_prompt_trace(MOD_MMI,_trace_, g_mmi_copter_end_time,__LINE__);\
    kal_prompt_trace(MOD_MMI,_trace2_, g_mmi_copter_duration,__LINE__);\
    }while(0)


/***************************************************************************** 
* Typedef 
*****************************************************************************/
#ifdef __MMI_GAME_MULTI_LANGUAGE_SUPPORT__
//added for multi-language support
typedef enum
{
    MMI_COPTER_STRING_GAMEOVER,
    MMI_COPTER_STRING_TOTAL
}mmi_copter_string_enum;
#endif  /* __MMI_GAME_MULTI_LANGUAGE_SUPPORT__ */

/* game context */
typedef struct t_copter_node
{
    S16 position_x;
    S16 position_y;
    S16 old_position_x;
    S16 old_position_y;
    struct t_copter_node *next;
} gx_copter_obstacle_node_struct;

#if defined(GDI_USING_LAYER)
typedef struct t_copter_bg_node
{
    MMI_ID_TYPE image_id;
    struct t_copter_bg_node *next;
} gx_copter_bg_node_struct;
#endif /* defined(GDI_USING_LAYER) */ 

typedef struct
{
    BOOL is_gameover;
    BOOL is_new_game;
    U8 game_level;
    S32 game_grade;
    U16 timer_elapse;
    BOOL key_pressed;
    U32 tick;
    U32 last_sound_playing_tick;
    S16 slope;
    U8 obstacle_period;
    U8 max_period;
    U8 space;
    U8 local_step;
    U8 copter_position_y;
    U8 copter_position_old_y;
    gx_copter_obstacle_node_struct obstacle[MMI_GX_COPTER_OBSTACLE_COUNT];
    gx_copter_obstacle_node_struct single_obstacle;
    gx_copter_obstacle_node_struct *first_obstacle;
    gx_copter_obstacle_node_struct *last_obstacle;

#if defined(GDI_USING_LAYER)
    gdi_handle background;
    gdi_handle foreground;
    gdi_handle dynamic_background;
    PU8 dynamic_bg_layer_buf_ptr;
    S32 bg_image_width;
    S32 bg_image_height;
    gx_copter_bg_node_struct bg_image_list[MMI_GX_COPTER_BG_LIST_NUMBER];
    gx_copter_bg_node_struct *first_bg_image;
    gx_copter_bg_node_struct *last_bg_image;
    S16 first_bg_position_x;
#endif /* defined(GDI_USING_LAYER) */ 

#if defined (__MMI_GAME_MULTICHANNEL_SOUND__)
    S32 background_midi;    /* 1 */
    S32 crash_midi;         /* 4 */
    S32 down_wav;           /* 2 */
    S32 flying_wav;         /* 3 */
#endif /* defined (__MMI_GAME_MULTICHANNEL_SOUND__) */ 
} gx_copter_context_struct;

/***************************************************************************** 
* Local Variable
*****************************************************************************/
static gx_copter_context_struct g_gx_copter_context = 
{
    FALSE,  /* is_gameover */
    TRUE,   /* is_new_game */
    0,      /* game_level */
    0,      /* game_grade */
    100,    /* timer_elapse */
    FALSE,  /* key_pressed */
    0,      /* tick */
    0,      /* slope */
    0,      /* period of obstacle-segment */
    10,     /* max period of segment */
    120,    /* space between floor and ceiliing */
    1,      /* local speed of copter */
    70,     /* initial y position of copter */
    70,     /* y position of copter in the last frame */

    0
};

#ifdef  __MMI_GAME_MULTI_LANGUAGE_SUPPORT__ /*added for game multi-language*/
static U16 mmi_copter_language_index;
#define MMI_COPTER_STRING_COUNT MMI_COPTER_STRING_TOTAL
#endif  /* __MMI_GAME_MULTI_LANGUAGE_SUPPORT__ */

/***************************************************************************** 
* Local Function
*****************************************************************************/
/* Game framework related functions */
S16 mmi_gx_copter_calc_best_grade(S16 old_grade, S16 new_grade);        /* descide which is best grade */
void mmi_gx_copter_enter_game(void);    /* entry function of the game */
void mmi_gx_copter_exit_game(void);     /* exit function - usually will stop timer and release buffer */
void mmi_gx_copter_draw_gameover(void); /* draw gameover screen */

/* Game play functions */
void mmi_gx_copter_framemove(void);
void mmi_gx_copter_render(void);
void mmi_gx_copter_gameover(void);
void mmi_gx_copter_cyclic_timer(void);
void mmi_gx_copter_init_game(void);     /* draw gameover screen */
void mmi_gx_copter_key_pressed(void);   /* press key */
void mmi_gx_copter_key_released(void);  /* release key */
void mmi_gx_copter_draw_static_background(void);
void mmi_gx_copter_init_obstacle_list(void);
void mmi_gx_copter_draw_crash(void);
void mmi_gx_copter_set_gameover(void);

/* void mmi_gx_copter_resume_bgm(void *info); */
#if defined(GDI_USING_LAYER)
void mmi_gx_copter_draw_background(void);
void mmi_gx_copter_init_background_list(void);
#endif /* defined(GDI_USING_LAYER) */ 

/************************************************************************/
/* Audio [Const]                                                        */
/************************************************************************/
#ifndef __MMI_GAME_MULTICHANNEL_SOUND__
#define COPTERDOWN_DVI     611
#define COPTERFLYING_DVI   530
#endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 

/* used in both */
#define COPTERCRASH_MIDI   132

#ifdef __MMI_GAME_MULTICHANNEL_SOUND__
#define COPTERBACKGROUND_MIDI    1063
#define COPTERDOWN_WAV    2444
#define COPTERFLYING_WAV  2122
#endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 

#ifndef __MMI_GAME_MULTICHANNEL_SOUND__

__align(2)
     const U8 CopterDown_dvi[611] = 
     {
         0x77, 0xD7, 0x77, 0x77, 0x0E, 0x08, 0xB7, 0xB7, 0x08, 0x17, 0x8D, 0x00, 0x88, 0x80, 0x80, 0x80,
         0x00, 0x80, 0x11, 0x80, 0x0A, 0x81, 0xBE, 0x80, 0x93, 0x24, 0x88, 0x1F, 0x10, 0x80, 0xA4, 0xB8,
         0x39, 0x31, 0x81, 0xF1, 0x1D, 0x40, 0x08, 0x81, 0xA1, 0xA1, 0xBA, 0x8D, 0x50, 0xA0, 0xA0, 0x89,
         0x2D, 0x50, 0xA0, 0xA0, 0x91, 0x29, 0x79, 0x89, 0x00, 0xB3, 0x01, 0x48, 0x1B, 0x8C, 0xA3, 0xF2,
         0x81, 0x28, 0x2F, 0x88, 0xC1, 0x95, 0x80, 0x29, 0x3A, 0x22, 0xB0, 0x97, 0x80, 0x31, 0x2A, 0x4B,
         0x09, 0xC8, 0xD1, 0x81, 0x80, 0x4C, 0x08, 0x9B, 0x01, 0xF9, 0x29, 0xA1, 0x8D, 0x23, 0xA9, 0x38,
         0x35, 0xAA, 0x31, 0xB5, 0x99, 0x40, 0x9F, 0x2A, 0xB1, 0xE3, 0xA2, 0x29, 0x6B, 0x19, 0xB3, 0xE8,
         0x28, 0x19, 0x79, 0x81, 0x99, 0x03, 0x11, 0x70, 0x08, 0xAA, 0xC1, 0x82, 0x11, 0x1A, 0x9F, 0x08,
         0xA2, 0x84, 0x93, 0x0E, 0x28, 0x88, 0x22, 0xD9, 0x09, 0xA4, 0x11, 0x24, 0x0E, 0x28, 0xB0, 0x11,
         0xC2, 0x9E, 0x10, 0x89, 0x39, 0xA0, 0x8D, 0x33, 0x83, 0x82, 0xE0, 0x8C, 0x59, 0x18, 0x98, 0xF2,
         0x98, 0x33, 0x30, 0x49, 0xEB, 0x98, 0xA3, 0x10, 0x11, 0xAF, 0x29, 0xB2, 0x06, 0x83, 0x1D, 0x29,
         0x0A, 0x93, 0xD5, 0x00, 0x2A, 0x3C, 0x10, 0xB1, 0xC3, 0x91, 0x49, 0x3C, 0x19, 0xC8, 0x91, 0x93,
         0x21, 0x42, 0x18, 0x39, 0x88, 0x90, 0xD4, 0x93, 0xAD, 0x2C, 0x28, 0x9A, 0x97, 0xB1, 0x3A, 0x4D,
         0x1B, 0xA0, 0xE3, 0x00, 0x40, 0x3B, 0x29, 0xD2, 0xA2, 0x84, 0x9A, 0x59, 0x8A, 0x1B, 0xC1, 0xD0,
         0x92, 0x38, 0x38, 0x8D, 0x20, 0xF8, 0x21, 0x94, 0x8C, 0x31, 0xCA, 0x43, 0xB3, 0x8C, 0x31, 0x90,
         0x02, 0xA7, 0xC9, 0x31, 0x0B, 0x2C, 0xA2, 0xF8, 0x81, 0x92, 0x6C, 0x28, 0x9C, 0x82, 0xD3, 0x10,
         0x01, 0x0E, 0x20, 0x98, 0x11, 0xA3, 0x1A, 0x15, 0xAC, 0x30, 0xB8, 0x8B, 0xA7, 0xA9, 0x31, 0x21,
         0x89, 0x1B, 0x73, 0x95, 0xE0, 0x99, 0x09, 0x33, 0xA0, 0x00, 0x40, 0x19, 0x3A, 0xB2, 0xF9, 0x13,
         0xF1, 0x1B, 0x19, 0x8B, 0x83, 0xA8, 0x73, 0x02, 0x08, 0xB9, 0xBC, 0xA9, 0x32, 0x14, 0x19, 0x49,
         0x88, 0x63, 0xA1, 0x9C, 0x86, 0xA9, 0x39, 0x01, 0x80, 0x41, 0xE9, 0x19, 0x87, 0x99, 0x28, 0x9C,
         0x3B, 0x82, 0xA8, 0x07, 0xB8, 0x79, 0x18, 0x0B, 0x92, 0xEA, 0x11, 0x91, 0x2A, 0x23, 0x0B, 0x58,
         0xA8, 0x91, 0xA6, 0xAA, 0x2B, 0x9C, 0x28, 0x17, 0x81, 0x18, 0x99, 0x81, 0x07, 0xA1, 0x0D, 0x2A,
         0x88, 0x26, 0xB2, 0xA9, 0x22, 0x38, 0x59, 0xBA, 0xBC, 0xC1, 0x03, 0x82, 0x2B, 0x2D, 0x3C, 0x04,
         0xD2, 0xA0, 0xA0, 0x38, 0x3B, 0x1F, 0xBA, 0x81, 0x87, 0x88, 0x18, 0xAB, 0x61, 0x81, 0x0C, 0x80,
         0xE9, 0x23, 0x02, 0x2E, 0x89, 0xA9, 0x87, 0x82, 0x18, 0x8B, 0x1A, 0x93, 0x88, 0x22, 0xDC, 0x30,
         0x11, 0x6B, 0x12, 0xC0, 0x82, 0x80, 0x2D, 0x3A, 0xB8, 0xF0, 0xA3, 0x18, 0x78, 0x08, 0x8A, 0xB0,
         0xB9, 0x03, 0xA8, 0x4A, 0x0C, 0x59, 0x83, 0x83, 0x96, 0x99, 0x29, 0x0D, 0x19, 0x80, 0xA5, 0xA2,
         0x41, 0x1A, 0x7C, 0x90, 0xCA, 0x91, 0xBA, 0x50, 0x01, 0x39, 0x01, 0x1B, 0x07, 0x91, 0x05, 0xDB,
         0x39, 0x88, 0x3B, 0x87, 0xE0, 0x01, 0x08, 0x4B, 0x80, 0xD9, 0xB1, 0x91, 0x30, 0x48, 0x98, 0x9A,
         0x15, 0x80, 0x24, 0xD0, 0x2B, 0x20, 0x1A, 0x06, 0xE8, 0x80, 0x18, 0x39, 0xA0, 0xBA, 0x01, 0x08,
         0x26, 0xB8, 0x1B, 0x9A, 0x3B, 0x37, 0xC9, 0x30, 0x10, 0x41, 0x17, 0xA9, 0x9B, 0xA9, 0x09, 0x24,
         0xCB, 0x8B, 0x10, 0x50, 0x24, 0xD9, 0xA9, 0xD9, 0x2A, 0x12, 0xBC, 0x12, 0xA3, 0x73, 0x24, 0x89,
         0xB2, 0xB8, 0x88, 0x0D, 0x11, 0xAB, 0x43, 0x91, 0x64, 0x92, 0x8B, 0x91, 0xBB, 0x29, 0x88, 0x01,
         0x93, 0x00, 0x78, 0x17, 0x80, 0xC8, 0x81, 0x98, 0x49, 0x99, 0x8C, 0x04, 0x00, 0x34, 0xDB, 0x09,
         0xC8, 0x39, 0x02, 0xAE, 0x80, 0xA8, 0x51, 0x11, 0x9B, 0xAB, 0xA8, 0x31, 0x16, 0xC9, 0x08, 0x90,
         0x7A, 0x83, 0xCB, 0x82, 0xA0, 0x70, 0x18, 0x29, 0x80, 0x93, 0xA5, 0x8A, 0x39, 0x1F, 0x38, 0xB0,
         0x90, 0x07, 0x21, 0x68, 0x0B, 0xA9, 0xC2, 0x03, 0x00, 0x1E, 0x18, 0x08, 0x35, 0xB1, 0x9A, 0xC1,
         0x99, 0x42, 0x0C, 0x8D, 0xA9, 0x95, 0x94, 0x21, 0x0C, 0x1D, 0x80, 0xB0, 0xA4, 0xC1, 0x39, 0x6B,
         0x1A, 0x92, 0xC2
     };

__align(2)
     const U8 CopterFlying_dvi[530] = 
     {
         0x77, 0xD7, 0x77, 0x77, 0x0E, 0x08, 0xB7, 0xB7, 0x08, 0x17, 0x8D, 0x01, 0x81, 0xB8, 0x8B, 0x08,
         0x43, 0x21, 0x02, 0x91, 0x2B, 0x80, 0xFD, 0xBC, 0x33, 0x95, 0x99, 0x2D, 0x1A, 0x28, 0xA5, 0xB0,
         0x21, 0x17, 0x88, 0xDA, 0x1B, 0x40, 0x92, 0xB0, 0x30, 0x02, 0xBB, 0x90, 0x52, 0x01, 0xA0, 0x9E,
         0x0C, 0x21, 0x10, 0x89, 0x2A, 0x11, 0x4A, 0x01, 0x58, 0xA9, 0xB8, 0xAA, 0x40, 0xA0, 0x30, 0x1D,
         0xC0, 0x26, 0x88, 0x80, 0xE8, 0x14, 0x8A, 0xC8, 0x89, 0x17, 0xA9, 0x80, 0x0C, 0x21, 0x1B, 0x20,
         0x08, 0x80, 0x19, 0x2C, 0x13, 0x58, 0x19, 0x42, 0xA0, 0x09, 0x39, 0xFA, 0x28, 0x95, 0x8C, 0xAB,
         0x28, 0x89, 0x2D, 0x28, 0x13, 0x28, 0x01, 0x68, 0x99, 0xF3, 0x88, 0x91, 0x21, 0xF0, 0x02, 0x00,
         0xAF, 0x03, 0x93, 0x28, 0x40, 0xB0, 0x95, 0x0A, 0x2A, 0xD9, 0x0B, 0x7B, 0x88, 0x00, 0xB1, 0x80,
         0xAA, 0x19, 0xA3, 0x28, 0x19, 0x17, 0x86, 0x00, 0x84, 0x81, 0x18, 0xC2, 0x08, 0xC3, 0xF8, 0x88,
         0x1A, 0x98, 0xBA, 0x50, 0x0A, 0x23, 0x48, 0x79, 0x0A, 0x10, 0x99, 0x1D, 0x20, 0xD9, 0x18, 0x12,
         0x2C, 0x85, 0x80, 0x83, 0xA8, 0xC6, 0x99, 0x88, 0xE1, 0xC1, 0x88, 0x30, 0x98, 0x59, 0x90, 0x01,
         0x52, 0x80, 0x21, 0x53, 0x1B, 0x9B, 0x30, 0x9C, 0x0D, 0x08, 0x5D, 0x3B, 0x3C, 0xB2, 0xDA, 0x19,
         0xA0, 0xE2, 0x12, 0x59, 0x81, 0xA1, 0x13, 0x33, 0xFF, 0x81, 0x81, 0x19, 0x00, 0x19, 0x88, 0x4C,
         0x2A, 0x80, 0x20, 0x00, 0x61, 0x1A, 0xC9, 0x09, 0xA0, 0xAE, 0xB9, 0x44, 0x88, 0x1C, 0x91, 0x80,
         0x48, 0x33, 0x09, 0x94, 0x34, 0x9B, 0xB0, 0x31, 0x68, 0x31, 0xDD, 0x87, 0xCA, 0xA2, 0x8A, 0x17,
         0xA9, 0x19, 0x8A, 0x86, 0x09, 0x18, 0x08, 0x04, 0x2B, 0x0B, 0xA2, 0x39, 0xC2, 0xBC, 0x2B, 0x4E,
         0x02, 0x31, 0xA0, 0x33, 0xF8, 0x98, 0x15, 0x02, 0xCF, 0xBA, 0x12, 0x33, 0x95, 0xA9, 0x9C, 0x35,
         0xD3, 0x1A, 0x78, 0x82, 0xF9, 0x0A, 0x00, 0x24, 0xA0, 0x09, 0x58, 0x08, 0x8A, 0xD8, 0x90, 0x33,
         0xA2, 0xAE, 0x1A, 0x10, 0x88, 0x20, 0x51, 0x20, 0x83, 0xC9, 0xFB, 0x09, 0x31, 0x21, 0x92, 0xAC,
         0x32, 0x11, 0xAA, 0x9D, 0x13, 0x89, 0x91, 0xCA, 0x83, 0x29, 0xD9, 0x82, 0x87, 0x89, 0x11, 0x11,
         0x99, 0x9C, 0x93, 0x05, 0xA2, 0x0D, 0x18, 0x13, 0xD8, 0x9C, 0x08, 0x02, 0x2A, 0xA8, 0x1E, 0x88,
         0x71, 0x07, 0xA9, 0xA8, 0x09, 0x03, 0x99, 0x20, 0x10, 0x83, 0xA9, 0xF0, 0x98, 0x92, 0x40, 0x51,
         0x99, 0x53, 0x90, 0xD8, 0x88, 0x91, 0xBA, 0x90, 0x2B, 0xE1, 0x28, 0x51, 0xB8, 0x89, 0xB1, 0x27,
         0x14, 0x1B, 0xC2, 0x38, 0x01, 0x2A, 0xAB, 0xE0, 0x23, 0x48, 0x9B, 0x0A, 0x18, 0xBF, 0xA0, 0x25,
         0xE9, 0x08, 0x24, 0x89, 0xB9, 0x0B, 0x25, 0x82, 0xA0, 0x18, 0x10, 0x1D, 0x98, 0x7B, 0x03, 0x01,
         0xA9, 0xA9, 0x78, 0x99, 0x32, 0x8D, 0x9C, 0xAB, 0x91, 0xC9, 0x23, 0xA8, 0x07, 0x81, 0x31, 0x28,
         0x25, 0x28, 0x80, 0x92, 0x87, 0x2A, 0xB0, 0xCB, 0xA8, 0x9F, 0x8A, 0x29, 0x94, 0x6A, 0xA8, 0x88,
         0x29, 0x03, 0x54, 0x9A, 0x08, 0x0A, 0xA3, 0xC1, 0x83, 0x27, 0x84, 0xBD, 0x18, 0x39, 0x87, 0xB9,
         0x28, 0xA2, 0xB9, 0x2C, 0x90, 0x8A, 0x69, 0x00, 0xC4, 0x88, 0x2A, 0x98, 0x16, 0xB8, 0x13, 0x4C,
         0x15, 0xB3, 0x88, 0xB9, 0x68, 0x80, 0xD1, 0x28, 0xAB, 0xD1, 0x89, 0xA2, 0xE8, 0x80, 0x71, 0x81,
         0x29, 0x11, 0xB0, 0xA2, 0xE9, 0x80, 0x18, 0x23, 0x38, 0xC8, 0x1A, 0x27, 0xCE, 0x88, 0x2A, 0x37,
         0x98, 0x08, 0x9A, 0x00, 0x88, 0x11, 0xCA, 0xAD, 0x21, 0x13, 0x0A, 0xAD, 0x14, 0x94, 0x91, 0x8D,
         0x28, 0x21, 0x94, 0x8B, 0x17, 0xA8, 0x19, 0x99, 0xC3, 0xAB, 0x02, 0x4A, 0xA5, 0xAF, 0x19, 0x43,
         0xB3, 0x8E
     };

#endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 

__align(2)
     const U8 CopterCrash_midi[132] = 
     {
         0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x03, 0xC0, 0x4D, 0x54, 0x72,
         0x6B, 0x00, 0x00, 0x00, 0x6E, 0x00, 0xFF, 0x03, 0x08, 0x75, 0x6E, 0x74, 0x69, 0x74, 0x6C, 0x65,
         0x64, 0x00, 0xFF, 0x02, 0x16, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x63,
         0x20, 0x32, 0x30, 0x30, 0x33, 0x20, 0x62, 0x79, 0x20, 0x43, 0x43, 0x00, 0xFF, 0x01, 0x03, 0x43,
         0x43, 0x0A, 0x00, 0xFF, 0x58, 0x04, 0x04, 0x02, 0x18, 0x08, 0x00, 0xFF, 0x59, 0x02, 0x00, 0x00,
         0x00, 0xFF, 0x51, 0x03, 0x09, 0x27, 0xC0, 0x00, 0xC0, 0x7F, 0x00, 0xB0, 0x07, 0x64, 0x11, 0x90,
         0x28, 0x67, 0x10, 0x2B, 0x67, 0x03, 0x29, 0x7D, 0x1D, 0x26, 0x7F, 0x03, 0x24, 0x6F, 0x9C, 0x45,
         0x29, 0x00, 0x0F, 0x2B, 0x00, 0x82, 0x63, 0x24, 0x00, 0x13, 0x28, 0x00, 0x10, 0x26, 0x00, 0x00,
         0xFF, 0x2F, 0x00
     };

/* /MANISH STARTS */

 #ifdef __MMI_GAME_MULTICHANNEL_SOUND__

__align(2)
     const U8 CopterFlying_wav[2122] = 
     {
         0x52, 0x49, 0x46, 0x46, 0x42, 0x08, 0x00, 0x00,
         0x57, 0x41, 0x56, 0x45, 0x66, 0x6D, 0x74, 0x20,
         0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
         0x40, 0x1F, 0x00, 0x00, 0x80, 0x3E, 0x00, 0x00,
         0x02, 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61,
         0x1E, 0x08, 0x00, 0x00, 0xF3, 0x14, 0xF7, 0x28,
         0xEA, 0x48, 0x86, 0x3F, 0x5F, 0x28, 0x48, 0xF7,
         0x6C, 0xCC, 0xD0, 0xC4, 0x44, 0xBE, 0xB1, 0xC8,
         0x19, 0xE9, 0xAF, 0x0E, 0x98, 0x18, 0x39, 0x30,
         0xAB, 0x45, 0x66, 0x4A, 0xFF, 0x51, 0xD4, 0x49,
         0xA2, 0x37, 0x1B, 0x44, 0x2A, 0x46, 0xC9, 0x44,
         0xD6, 0x2C, 0xFA, 0xE8, 0xC9, 0xCA, 0x17, 0x96,
         0x60, 0xC5, 0x0A, 0xEE, 0xC0, 0x2B, 0xC2, 0x1C,
         0x08, 0x02, 0xBC, 0xF2, 0x25, 0xAE, 0x48, 0xD2,
         0x35, 0xAD, 0x7A, 0xC4, 0xE7, 0xBD, 0x22, 0xDE,
         0x74, 0x14, 0x2E, 0xEC, 0xF3, 0xFA, 0x01, 0xC3,
         0xDF, 0xD6, 0x68, 0xF6, 0xFF, 0x53, 0x03, 0x6D,
         0xA5, 0x5A, 0xD0, 0x4C, 0x72, 0x22, 0x24, 0xD0,
         0x00, 0x80, 0xCA, 0xAD, 0xA1, 0xAA, 0xFC, 0xF5,
         0xC7, 0x2C, 0x61, 0x0F, 0xD3, 0x10, 0x18, 0xE1,
         0x20, 0xE8, 0xE5, 0x14, 0x3E, 0x30, 0xCC, 0x34,
         0x93, 0x12, 0xC8, 0xFC, 0x7B, 0xFA, 0x80, 0xF2,
         0x62, 0x04, 0xB0, 0x23, 0x63, 0x31, 0x65, 0x34,
         0x43, 0x37, 0x4B, 0x28, 0xD7, 0xFE, 0x32, 0xEE,
         0xEF, 0xCA, 0xF9, 0xCD, 0x6C, 0xDE, 0x11, 0xF0,
         0xF7, 0xF7, 0x3B, 0x04, 0x8F, 0xF9, 0xB6, 0xF4,
         0x37, 0xE9, 0xC9, 0xF6, 0xC1, 0xFC, 0xC3, 0x00,
         0xCD, 0xF8, 0xE7, 0x07, 0x75, 0x0E, 0x26, 0x12,
         0x91, 0x10, 0x73, 0x22, 0xE0, 0x18, 0x82, 0x10,
         0x73, 0x0E, 0x5D, 0x00, 0x2E, 0xF8, 0xCF, 0xF0,
         0x71, 0xF2, 0x61, 0xFE, 0x61, 0x00, 0x13, 0xF8,
         0xBF, 0xF9, 0x40, 0x02, 0x78, 0xF7, 0x5B, 0xFA,
         0x1B, 0xFD, 0x31, 0xF2, 0x72, 0x05, 0x1D, 0x0F,
         0xBC, 0x0D, 0x9E, 0x0D, 0x7C, 0x0E, 0x8E, 0x0C,
         0xEF, 0x0B, 0x83, 0xF9, 0x1F, 0x10, 0xF1, 0x19,
         0xF0, 0x08, 0xF9, 0x06, 0x83, 0x08, 0xD9, 0xF0,
         0x57, 0xEB, 0x1E, 0xE8, 0x7D, 0x07, 0xDB, 0x17,
         0x58, 0x06, 0xE9, 0xF4, 0xA3, 0xFA, 0x47, 0xF9,
         0x3C, 0xE0, 0x15, 0xDF, 0xB3, 0xEA, 0x6E, 0xF8,
         0xBE, 0xE4, 0x93, 0xEE, 0xC9, 0xEF, 0x70, 0xF8,
         0xB2, 0xF7, 0x70, 0xF9, 0x1F, 0xFA, 0x77, 0xFA,
         0x79, 0xF5, 0x54, 0xF8, 0xEF, 0xF0, 0x21, 0xF6,
         0xED, 0xFD, 0x08, 0x01, 0x01, 0x00, 0xCA, 0x09,
         0xD6, 0x04, 0x26, 0x09, 0xBB, 0x0E, 0xE9, 0x16,
         0x5E, 0x16, 0x79, 0x12, 0x2B, 0x10, 0x63, 0x10,
         0x8C, 0x0D, 0x79, 0x12, 0xB9, 0x0F, 0xC0, 0x07,
         0x33, 0x06, 0xD9, 0x0A, 0xDE, 0x15, 0xF7, 0x10,
         0xBC, 0x05, 0x65, 0x03, 0xD2, 0xF8, 0x2F, 0xF3,
         0x3D, 0xF2, 0x91, 0xF8, 0x16, 0xF5, 0x13, 0xF4,
         0x63, 0xEB, 0xF6, 0xF1, 0xBC, 0xEF, 0xD3, 0xF4,
         0x43, 0xFB, 0x2D, 0xFE, 0x46, 0xFD, 0x07, 0x00,
         0x41, 0x02, 0x3D, 0x03, 0x10, 0x02, 0x2E, 0x08,
         0x4B, 0x05, 0xAA, 0x03, 0x3D, 0x08, 0xC8, 0xFB,
         0x03, 0xFF, 0x4C, 0xFD, 0xAB, 0x00, 0x89, 0xFC,
         0x56, 0xFF, 0x2C, 0x03, 0x25, 0x05, 0x95, 0xF9,
         0x00, 0x02, 0x67, 0x03, 0x65, 0x04, 0x25, 0x06,
         0x32, 0xED, 0x2C, 0xEA, 0x28, 0xF9, 0xC8, 0xFB,
         0x0C, 0x05, 0x66, 0x02, 0x41, 0x01, 0x01, 0x06,
         0xC6, 0x07, 0xC2, 0x10, 0xEE, 0x12, 0x27, 0x0B,
         0x14, 0x16, 0xCF, 0x0F, 0xA3, 0x0A, 0x91, 0x0B,
         0xCE, 0x04, 0x57, 0x0A, 0xAE, 0x07, 0x47, 0xFF,
         0xBA, 0xF5, 0x77, 0xF8, 0x3F, 0xF1, 0x32, 0x03,
         0x23, 0xFD, 0xE4, 0xFB, 0xA7, 0xFC, 0x88, 0xFC,
         0x9C, 0x00, 0x1D, 0xF8, 0x5A, 0xF9, 0x4B, 0xF9,
         0xF2, 0xF4, 0x29, 0xF1, 0xE1, 0xEE, 0xE9, 0xEF,
         0xDD, 0xF4, 0xD9, 0xF1, 0xEA, 0xF0, 0x5C, 0xF3,
         0x40, 0xF2, 0x20, 0xF3, 0x72, 0xFD, 0x7C, 0xFA,
         0x60, 0x04, 0x13, 0x03, 0x8B, 0x04, 0xA1, 0x05,
         0xD9, 0x0D, 0xAF, 0x0B, 0x10, 0x0E, 0x2F, 0x0E,
         0x0C, 0x0D, 0xEE, 0x0E, 0x01, 0x13, 0x02, 0x0D,
         0x12, 0x0D, 0x26, 0x0D, 0x21, 0x12, 0x80, 0x0C,
         0x27, 0x0C, 0xF6, 0x00, 0x0A, 0x01, 0xC2, 0xFF,
         0x29, 0xFA, 0x47, 0xFE, 0xD1, 0xFC, 0x41, 0xF9,
         0x44, 0xF6, 0xFB, 0xF0, 0x7C, 0xF2, 0xB4, 0xF8,
         0xED, 0xF4, 0x8F, 0xF5, 0x37, 0xFA, 0x6B, 0xFD,
         0xFB, 0xFB, 0x94, 0x00, 0x1E, 0xFF, 0x3E, 0x09,
         0x2F, 0x02, 0xC9, 0x01, 0x4D, 0x04, 0xD2, 0x06,
         0x7E, 0x04, 0x3D, 0x02, 0x78, 0xF9, 0x5F, 0xFD,
         0xA0, 0xFE, 0x1E, 0x02, 0x35, 0xFF, 0xCC, 0xF8,
         0x3B, 0xF7, 0x02, 0xFA, 0x7D, 0xFE, 0x9B, 0x00,
         0x4A, 0xFA, 0x79, 0xFE, 0x48, 0x06, 0x30, 0x05,
         0x6D, 0x07, 0xE0, 0x05, 0x04, 0x0C, 0x51, 0x0A,
         0x21, 0x0A, 0x94, 0x06, 0x6D, 0x0E, 0xD8, 0x04,
         0x6E, 0x02, 0x4E, 0xFD, 0x6C, 0xFC, 0x38, 0xFC,
         0xFA, 0xFE, 0xB6, 0xF4, 0xD0, 0xF9, 0xE4, 0xEE,
         0x85, 0xEC, 0x56, 0xEB, 0x8C, 0xEC, 0xB4, 0xF3,
         0x3C, 0xF3, 0xAA, 0xEF, 0xA9, 0xED, 0xBB, 0xF5,
         0xEB, 0xF6, 0xA0, 0xF4, 0xF5, 0xF7, 0x22, 0xF8,
         0xEB, 0xFB, 0xDC, 0x02, 0xE2, 0x04, 0xAC, 0x02,
         0xA0, 0x05, 0xF3, 0x08, 0xDC, 0x0D, 0x97, 0x15,
         0xA6, 0x0E, 0x23, 0x11, 0x1F, 0x0C, 0x86, 0x09,
         0xD4, 0x0A, 0xB4, 0x0E, 0x68, 0x0A, 0xE8, 0x07,
         0x7F, 0x01, 0xB7, 0x02, 0x63, 0x02, 0x5B, 0x02,
         0xB6, 0xFB, 0xBA, 0x05, 0xD5, 0xFC, 0xBE, 0x05,
         0x4C, 0xFB, 0xAB, 0x04, 0x94, 0x09, 0x07, 0x02,
         0xF5, 0xFD, 0xEE, 0xF2, 0x6C, 0xEE, 0x40, 0xF3,
         0x9C, 0xF4, 0x82, 0xEF, 0xC7, 0xF3, 0x42, 0xE9,
         0x17, 0xF1, 0xF2, 0xF4, 0xED, 0xF1, 0x94, 0xFC,
         0x74, 0x00, 0x8B, 0x01, 0xF4, 0x04, 0x36, 0xFF,
         0x82, 0x06, 0xA0, 0x08, 0xED, 0x0E, 0xBD, 0x15,
         0x17, 0xFE, 0x51, 0xF2, 0xF4, 0xFB, 0xFC, 0xF8,
         0x41, 0x03, 0x8B, 0x00, 0x63, 0xF7, 0x7A, 0x00,
         0x21, 0x01, 0x25, 0x01, 0xBA, 0xFD, 0x14, 0x02,
         0x6E, 0xFF, 0x13, 0xFF, 0xDE, 0xF4, 0xF9, 0xFF,
         0xF4, 0xF7, 0x3E, 0x00, 0xAB, 0x01, 0x08, 0x01,
         0x3C, 0x02, 0x99, 0x07, 0xD4, 0x07, 0xEC, 0x08,
         0x54, 0x0B, 0x9F, 0x13, 0x6B, 0x0D, 0xAB, 0x10,
         0xCC, 0x0D, 0xE8, 0x04, 0x65, 0x02, 0x53, 0x03,
         0x0D, 0x05, 0xC4, 0xFF, 0xDB, 0xF6, 0xBE, 0xEF,
         0x81, 0xEC, 0x4D, 0xE4, 0x81, 0xED, 0x73, 0xF8,
         0xB4, 0xF7, 0x3C, 0xF4, 0x9C, 0xE9, 0x5B, 0xEF,
         0xD3, 0xF2, 0x42, 0xF0, 0xC1, 0xEF, 0x63, 0xEE,
         0x6B, 0xEE, 0xEF, 0xF5, 0x64, 0xFC, 0x52, 0x03,
         0x15, 0x01, 0x89, 0x01, 0x53, 0x08, 0x11, 0x06,
         0x3C, 0x0C, 0xBC, 0x11, 0x42, 0x0D, 0x1D, 0x0B,
         0x77, 0x0A, 0x1D, 0x07, 0x51, 0x08, 0xCA, 0x0B,
         0x01, 0x0C, 0x4C, 0x11, 0xE6, 0x12, 0x2A, 0x18,
         0xA1, 0x11, 0xA4, 0x06, 0x5D, 0x1C, 0x50, 0x19,
         0x9C, 0x0B, 0xF1, 0xF4, 0xF4, 0x01, 0xA2, 0xF8,
         0x98, 0xED, 0x61, 0xEA, 0x69, 0x10, 0x3D, 0x16,
         0x50, 0x0B, 0x90, 0xF7, 0xDE, 0xEB, 0xFD, 0xF2,
         0xCC, 0xEA, 0x04, 0xE7, 0x88, 0x00, 0x19, 0x00,
         0x3F, 0xF1, 0xDB, 0xF4, 0x48, 0xF3, 0x93, 0xF9,
         0x9E, 0xF7, 0x2C, 0xFD, 0x1A, 0x0E, 0x3A, 0x0F,
         0x56, 0x01, 0x2D, 0x0C, 0xEA, 0xFE, 0x77, 0xFF,
         0x35, 0x07, 0xA1, 0x01, 0xC1, 0xFB, 0x0B, 0x05,
         0xF1, 0x09, 0x48, 0x02, 0xC0, 0xF6, 0x47, 0xEF,
         0xB0, 0xE4, 0xF1, 0xEA, 0x85, 0xDE, 0x09, 0xED,
         0xE0, 0xF9, 0x25, 0xFA, 0x33, 0x01, 0x6C, 0x0B,
         0x74, 0x0D, 0xBA, 0x06, 0x79, 0x0F, 0x6C, 0x16,
         0xAC, 0x15, 0x85, 0x06, 0x30, 0x04, 0xD0, 0xFF,
         0x91, 0x12, 0x15, 0x1B, 0x09, 0x25, 0x8A, 0x24,
         0x73, 0x06, 0xB3, 0xE5, 0x1F, 0xD4, 0xDB, 0xB4,
         0x48, 0xC9, 0x1C, 0xD2, 0x23, 0xE6, 0x2A, 0xFC,
         0xA2, 0x17, 0x72, 0x0B, 0xE9, 0x02, 0xED, 0xF5,
         0x23, 0xDB, 0x2E, 0xD1, 0x1E, 0xF4, 0x5B, 0x13,
         0x18, 0x32, 0x9C, 0x05, 0x51, 0xEE, 0x04, 0xF4,
         0x3C, 0xF8, 0x12, 0x58, 0x5B, 0x5A, 0x13, 0x54,
         0x65, 0x3C, 0x84, 0xBA, 0x49, 0x9F, 0x8C, 0x99,
         0x2A, 0xB1, 0x4E, 0xB5, 0x83, 0x0F, 0xF3, 0x47,
         0x51, 0x51, 0x5A, 0x29, 0x12, 0x0C, 0xAB, 0x19,
         0x4F, 0x08, 0xC1, 0x5B, 0x50, 0x44, 0xA8, 0x50,
         0xA9, 0x30, 0x89, 0x24, 0xE5, 0x1A, 0x45, 0xD8,
         0x3F, 0xEC, 0xB8, 0xC9, 0xBB, 0xFF, 0x77, 0x2B,
         0x48, 0x4D, 0xA0, 0x2F, 0xB1, 0xED, 0x77, 0xC6,
         0x78, 0x99, 0xFA, 0xAF, 0x39, 0xB2, 0x72, 0xC6,
         0xE2, 0xC6, 0xEE, 0xBD, 0x72, 0xC4, 0x31, 0xD4,
         0x93, 0xE4, 0x88, 0x09, 0x3B, 0x10, 0x4C, 0x24,
         0xE4, 0x42, 0xCF, 0x42, 0xC5, 0x34, 0x1B, 0x1A,
         0xE6, 0xFF, 0xD7, 0xCB, 0xC2, 0xB4, 0xAA, 0xB4,
         0x22, 0xD2, 0x23, 0xF8, 0x89, 0x03, 0x82, 0x19,
         0x51, 0x2B, 0xAA, 0x25, 0x82, 0x03, 0x5B, 0xF3,
         0x7B, 0x03, 0xD3, 0x19, 0x99, 0x26, 0x6F, 0x2C,
         0x1E, 0x20, 0x91, 0x11, 0xCC, 0xFA, 0xF4, 0xF1,
         0xEE, 0x03, 0xFA, 0x0C, 0x92, 0x08, 0xBA, 0x05,
         0x4B, 0x0A, 0xBC, 0x05, 0xCF, 0xFC, 0xBB, 0xF1,
         0x5D, 0xFC, 0xAF, 0xFB, 0x45, 0xF6, 0x52, 0xFC,
         0x39, 0xFA, 0x13, 0xEE, 0x8C, 0xF4, 0xA2, 0xF5,
         0x6C, 0x07, 0x28, 0x07, 0x29, 0xFF, 0x65, 0xFB,
         0x42, 0x02, 0x9D, 0x09, 0x4D, 0x0E, 0x9F, 0x11,
         0x43, 0x0D, 0xD9, 0x09, 0x77, 0xFF, 0xBF, 0xF9,
         0xAD, 0x02, 0xC7, 0x00, 0x2C, 0x0B, 0xD2, 0x0E,
         0xB0, 0x15, 0xBE, 0x0E, 0x10, 0x02, 0x06, 0x04,
         0x33, 0x01, 0x21, 0x05, 0x14, 0x0F, 0xCE, 0x12,
         0xAA, 0x11, 0x87, 0x06, 0xAA, 0xF8, 0xDF, 0xF3,
         0x52, 0xF1, 0x1D, 0xF4, 0xD8, 0xF9, 0xC3, 0xFB,
         0xC5, 0xF5, 0xA0, 0xFA, 0x35, 0xF9, 0x4A, 0xF6,
         0xD9, 0xEB, 0xDF, 0xEF, 0x0E, 0xF0, 0xC4, 0xED,
         0x74, 0xF1, 0x41, 0x06, 0x9C, 0x1C, 0xDE, 0x1D,
         0x78, 0x11, 0xF4, 0x04, 0xC0, 0x00, 0xD6, 0xF2,
         0x63, 0xE9, 0xCC, 0xED, 0xD0, 0xFA, 0x29, 0xFD,
         0x49, 0xF9, 0x4A, 0xF4, 0x3D, 0xF5, 0xC3, 0xFB,
         0xA3, 0xFD, 0x15, 0xFF, 0x73, 0x06, 0x68, 0x05,
         0xF5, 0x03, 0x2E, 0x00, 0x16, 0x00, 0x52, 0xF7,
         0x3A, 0xF5, 0x25, 0xF3, 0x46, 0xF7, 0xBF, 0xF4,
         0x5D, 0xF6, 0x0D, 0xFD, 0x9C, 0x00, 0x92, 0x09,
         0xFF, 0x05, 0x07, 0x02, 0x2E, 0x0B, 0x58, 0x16,
         0x26, 0x18, 0xE5, 0x12, 0x9C, 0x10, 0x65, 0x04,
         0xF7, 0x04, 0x3D, 0x01, 0x3F, 0x05, 0xB7, 0x03,
         0x8F, 0xFD, 0xD7, 0xF5, 0xB0, 0xF7, 0x15, 0xF5,
         0x9C, 0xEE, 0xB6, 0xF2, 0x4B, 0xF4, 0x54, 0xED,
         0xCB, 0xEC, 0x80, 0xF0, 0xB6, 0xF3, 0xD1, 0xFA,
         0xA5, 0xF9, 0x1E, 0xF4, 0x62, 0xF0, 0x60, 0xEF,
         0x98, 0xF1, 0x96, 0xED, 0xB8, 0xF6, 0x74, 0xFC,
         0x06, 0x09, 0x83, 0x0D, 0xC5, 0x03, 0xCA, 0x07,
         0xD9, 0x0C, 0x36, 0x04, 0xDE, 0x02, 0x0F, 0x09,
         0x73, 0x0C, 0xDB, 0x0D, 0x26, 0x0A, 0x08, 0x0D,
         0x61, 0x09, 0x79, 0x05, 0x98, 0x05, 0x9A, 0xFF,
         0xCE, 0x05, 0x63, 0x0A, 0xB6, 0x09, 0x47, 0x0F,
         0x6A, 0x09, 0x04, 0x07, 0x50, 0x04, 0x34, 0x04,
         0x69, 0x04, 0x72, 0x05, 0x89, 0xFE, 0x45, 0xF8,
         0xFE, 0xF7, 0x73, 0xF3, 0xA8, 0xFC, 0x44, 0x01,
         0x9C, 0xFF, 0x93, 0xF3, 0xAF, 0xF1, 0xEE, 0xF1,
         0x87, 0xFF, 0x72, 0x08, 0x5F, 0x02, 0xB1, 0x00,
         0xF7, 0xFD, 0xE7, 0xF4, 0xCC, 0xEE, 0x11, 0xEF,
         0x93, 0xF8, 0xF6, 0xFE, 0x2E, 0x04, 0x05, 0x04,
         0xAB, 0x04, 0xE4, 0x00, 0xA8, 0xFF, 0x33, 0x01,
         0x95, 0x02, 0x16, 0x04, 0x97, 0xFE, 0xB9, 0x00,
         0x55, 0x00, 0x49, 0xFE, 0x4B, 0xFA, 0xF0, 0x02,
         0x9D, 0x0A, 0x47, 0x0A, 0x7C, 0x0C, 0xA9, 0x0E,
         0x35, 0x0C, 0xAB, 0x08, 0xDB, 0x06, 0x5B, 0x03,
         0xCB, 0x02, 0x86, 0x0A, 0x0E, 0x08, 0xCC, 0x03,
         0x19, 0x08, 0x7E, 0x0D, 0xEC, 0x06, 0xE5, 0x05,
         0x03, 0xFE, 0x7A, 0xFA, 0x90, 0xF2, 0x72, 0xEE,
         0x6F, 0xF0, 0xD6, 0xED, 0xB0, 0xEB, 0x11, 0xE7,
         0x7F, 0xEC, 0x9D, 0xEF, 0x51, 0xEF, 0x89, 0xEB,
         0x90, 0xF6, 0xA7, 0xF4, 0x75, 0xF7, 0x64, 0xF6,
         0x06, 0xF9, 0x04, 0xFE, 0x3B, 0xFE, 0xA2, 0x01,
         0x7D, 0x07, 0xDA, 0x0A, 0x95, 0x0A, 0x46, 0x0E,
         0x5D, 0x0E, 0xAC, 0x0E, 0x02, 0x11, 0xDB, 0x0F,
         0x30, 0x17, 0x57, 0x14, 0x39, 0x10, 0x10, 0x14,
         0xE0, 0x15, 0x30, 0x11, 0xEB, 0x0C, 0xC1, 0x08,
         0x45, 0x08, 0xC3, 0x04, 0x20, 0xFC, 0x0D, 0xFA,
         0x1B, 0xF4, 0x32, 0xF4, 0x60, 0xF1, 0x78, 0xF5,
         0x00, 0xFB, 0x38, 0xF9, 0xBD, 0xF5, 0x82, 0xFD,
         0x7D, 0xFD, 0x4A, 0xF7, 0x20, 0xF6, 0xD0, 0xF4,
         0x8A, 0xF3, 0x4C, 0xF7, 0xD0, 0xFA, 0x7A, 0xFC,
         0x1C, 0x01, 0x34, 0x09, 0xB5, 0x02, 0x1E, 0x00,
         0x60, 0x00, 0x56, 0x00, 0xEA, 0xFC, 0x6A, 0xFD,
         0xB5, 0x01, 0xDE, 0xFF, 0x96, 0x00, 0xEA, 0xFC,
         0x7B, 0x00, 0x43, 0x00, 0x0B, 0x07, 0x7A, 0x0B,
         0x66, 0x12, 0xC6, 0x10, 0x0A, 0x07, 0x68, 0xFE,
         0x81, 0xFC, 0x66, 0xFF, 0x5D, 0xFC, 0x09, 0x03,
         0x47, 0x11, 0x0C, 0x0E, 0xBA, 0x08, 0x6B, 0xFE,
         0x00, 0xFE, 0xFA, 0x03, 0x7A, 0x0A, 0xE4, 0x04,
         0xEF, 0x01, 0x86, 0xFB, 0x90, 0xF4, 0x51, 0xF9,
         0xEA, 0xFA, 0xC8, 0xF8, 0x3F, 0xF5, 0x82, 0xF4,
         0xF5, 0xF1, 0xC7, 0xF8, 0x3E, 0xF9, 0x78, 0xFB,
         0x6D, 0x01, 0x8C, 0xF8, 0xC5, 0xF8, 0xA0, 0xF6,
         0xDE, 0xF2, 0x13, 0xF7, 0x1F, 0xF6, 0x7F, 0xF4,
         0xCA, 0xFC, 0x8A, 0xFE, 0xEF, 0xFD, 0xFF, 0xF7,
         0xDC, 0xFD, 0x20, 0x00, 0x74, 0xFA, 0x65, 0x01,
         0x6C, 0x0D, 0xE7, 0x11, 0x57, 0x19, 0xE1, 0x12,
         0xED, 0x10, 0x7D, 0x10, 0xC3, 0x0C, 0x01, 0x07,
         0x2D, 0x06, 0x7A, 0x0F, 0xF5, 0x10, 0xDC, 0x0E,
         0xC6, 0x11, 0x2F, 0x09, 0xE5, 0x07, 0x37, 0x0C,
         0x90, 0x04, 0xEB, 0xFF, 0xAF, 0x02, 0xE5, 0xF9,
         0x98, 0xF5, 0x49, 0xF5, 0x46, 0xFA, 0xE7, 0xF5,
         0x3E, 0xF5, 0xFC, 0xEA, 0x3D, 0xEC, 0xD4, 0xEB,
         0x51, 0xEF, 0x08, 0xFD, 0xB3, 0x04, 0x86, 0x01,
         0xBE, 0xFD, 0x06, 0x05, 0xC0, 0x0A, 0x93, 0x0D,
         0x54, 0x0D, 0x47, 0x07, 0x6E, 0x0B, 0x55, 0x07,
         0x59, 0x04, 0xC3, 0xFA, 0xFF, 0xFA, 0xFB, 0xFB,
         0xBF, 0xFA, 0x17, 0xFC, 0x6D, 0x02, 0x0D, 0x07,
         0xC4, 0x06, 0x3B, 0x0B, 0x7D, 0x0B, 0xDF, 0x05,
         0x44, 0x02, 0xCB, 0x03, 0x29, 0x0F, 0x3E, 0x12,
         0xA7, 0x04, 0xA2, 0xF4, 0x1F, 0xF1, 0x70, 0xEC,
         0xBF, 0xE2, 0xAE, 0xED, 0x72, 0x05, 0xA0, 0x1A,
         0xBC, 0x18, 0x7E, 0x14, 0x08, 0x0F, 0xE8, 0x11,
         0xE8, 0x06, 0x38, 0x03, 0xCF, 0x01, 0x20, 0x06,
         0xFF, 0x03, 0xFB, 0x02, 0x83, 0x06, 0xF8, 0x07,
         0xF3, 0x03, 0xDE, 0xFB, 0x55, 0xEF, 0x7D, 0xE7,
         0xBB, 0xEA, 0xD1, 0xF1, 0xF7, 0xF9, 0x0A, 0xFE,
         0xF1, 0xF9, 0xA9, 0xF9, 0x40, 0xF1, 0x07, 0xEA,
         0x3E, 0xF5, 0xA7, 0xF7, 0xDD, 0x03, 0xF8, 0xFE,
         0x0F, 0x03, 0xD0, 0xFE, 0xA3, 0xF3, 0xE2, 0xF1,
         0x1A, 0xF1, 0x66, 0xF6, 0x01, 0xFC, 0x69, 0x01,
         0x6D, 0x09, 0x5C, 0x05, 0x24, 0xFD, 0x78, 0xFC,
         0x2C, 0x0F, 0x40, 0x10, 0xB8, 0x0E, 0x9B, 0x06,
         0x09, 0x02, 0xDC, 0x06, 0xD2, 0x02, 0x6B, 0x00,
         0xC7, 0x06, 0x6D, 0xFE, 0x17, 0xF6, 0x6B, 0xF2,
         0x0D, 0xF6, 0xF1, 0xF6, 0x41, 0xF3, 0x76, 0xF9,
         0x5E, 0x02, 0x14, 0xFC, 0x0E, 0xEB, 0x6D, 0xE0,
         0xCF, 0xD9, 0x86, 0xE0, 0x0F, 0xEB, 0x06, 0xFA,
         0xFE, 0x06, 0xF2, 0xFC, 0xF3, 0xE5, 0x57, 0xE6,
         0x03, 0xF2,
     };

__align(2)
     const U8 CopterDown_wav[2444] = 
     {
         0x52, 0x49, 0x46, 0x46, 0x84, 0x09, 0x00, 0x00,
         0x57, 0x41, 0x56, 0x45, 0x66, 0x6D, 0x74, 0x20,
         0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
         0x40, 0x1F, 0x00, 0x00, 0x80, 0x3E, 0x00, 0x00,
         0x02, 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61,
         0x60, 0x09, 0x00, 0x00, 0x00, 0x00, 0x86, 0xFF,
         0xD5, 0xFF, 0x12, 0xFF, 0x05, 0xFE, 0x70, 0xFB,
         0x41, 0xFB, 0xEA, 0xFB, 0x97, 0xF9, 0x8C, 0xF9,
         0x5C, 0xFD, 0x9C, 0x04, 0x50, 0x05, 0x32, 0x04,
         0x13, 0x09, 0xBF, 0x11, 0x22, 0x19, 0x66, 0x13,
         0xD6, 0x08, 0x28, 0x0D, 0x57, 0x12, 0xB7, 0x10,
         0x80, 0xFD, 0xCA, 0xE7, 0xF5, 0xEC, 0xD1, 0xEA,
         0xA9, 0xF6, 0xF2, 0xF3, 0xAD, 0x01, 0xD5, 0x0C,
         0xEE, 0x09, 0x63, 0x07, 0x91, 0xEE, 0x5E, 0xFC,
         0xC5, 0xFE, 0x44, 0x04, 0xE3, 0x06, 0x9C, 0x04,
         0x50, 0x18, 0x83, 0x0C, 0xF5, 0x09, 0xA5, 0xFC,
         0x20, 0xF5, 0x80, 0x01, 0x5D, 0x07, 0x7A, 0x0F,
         0x63, 0x12, 0x7D, 0x12, 0x1D, 0x16, 0x3B, 0xFA,
         0x1C, 0xF1, 0x05, 0xFC, 0x14, 0xFE, 0x07, 0x12,
         0x15, 0x10, 0xB0, 0x13, 0x78, 0x18, 0x3B, 0x17,
         0xDA, 0x1B, 0xCA, 0x15, 0xD5, 0x19, 0x59, 0x12,
         0x9E, 0x0A, 0x2F, 0x03, 0xE8, 0xF5, 0x1C, 0xF6,
         0xE7, 0xF6, 0xB6, 0x03, 0x95, 0x08, 0x8C, 0xFF,
         0x53, 0x00, 0x39, 0xF7, 0x0E, 0xF5, 0x3C, 0xF3,
         0x91, 0xE6, 0xD5, 0xED, 0x82, 0xF0, 0xA9, 0xFE,
         0x43, 0xFF, 0x0F, 0xF9, 0xA0, 0xF8, 0x1C, 0xF1,
         0x89, 0xF5, 0x2E, 0xF2, 0x82, 0xEE, 0xC6, 0xF4,
         0xB8, 0xF1, 0x78, 0xFE, 0xE6, 0xF8, 0xE1, 0xF6,
         0xD0, 0xF8, 0xF7, 0xF9, 0x08, 0x02, 0x90, 0xFB,
         0xF7, 0xFE, 0x76, 0xFE, 0xF3, 0xFD, 0xE5, 0x04,
         0xCE, 0xFD, 0xB5, 0x01, 0x8B, 0xFA, 0xDC, 0xF9,
         0x5D, 0xFF, 0x1F, 0xFB, 0x1E, 0xFE, 0xC1, 0xF3,
         0x78, 0xFA, 0xDD, 0xF8, 0x64, 0xF6, 0x28, 0xFB,
         0x3E, 0xEC, 0x8B, 0xF7, 0xC9, 0xF4, 0x99, 0xF5,
         0xEF, 0xF9, 0x61, 0xEC, 0xEC, 0xFE, 0xB2, 0xF8,
         0xF4, 0xFA, 0x89, 0xF9, 0x30, 0xF4, 0xD2, 0xFA,
         0xE7, 0xF1, 0xBD, 0xFD, 0xAA, 0x01, 0x19, 0x08,
         0x22, 0x0A, 0x6C, 0x03, 0x6B, 0x10, 0xDB, 0x0B,
         0x00, 0x0D, 0x52, 0x09, 0xC9, 0x0D, 0x48, 0x16,
         0x43, 0x10, 0x2F, 0x17, 0xEE, 0x0F, 0x81, 0x17,
         0x03, 0x14, 0x7B, 0x14, 0x55, 0x14, 0x01, 0x0D,
         0xFB, 0x0F, 0xCA, 0x07, 0xC5, 0x0A, 0xD4, 0x09,
         0xD5, 0x09, 0x2E, 0x0A, 0x2A, 0x03, 0x8C, 0x0B,
         0x34, 0x09, 0xAD, 0x0A, 0xA1, 0x03, 0xB3, 0x00,
         0xCE, 0x04, 0x93, 0x04, 0x30, 0x03, 0xA9, 0xF7,
         0xE7, 0xF5, 0x67, 0xFA, 0x3A, 0xFE, 0x01, 0xFA,
         0xAB, 0xEF, 0x73, 0xEF, 0xED, 0xF5, 0xFD, 0xFB,
         0xE2, 0xF9, 0x80, 0xF5, 0x4F, 0xF3, 0xEB, 0xF9,
         0x50, 0x01, 0x2C, 0x07, 0xC0, 0x02, 0xC0, 0xFE,
         0xE0, 0x00, 0x94, 0x05, 0xEC, 0x0C, 0x01, 0x07,
         0xFD, 0x03, 0x1B, 0x02, 0x77, 0x02, 0x19, 0x08,
         0x1B, 0xFC, 0xEB, 0xF8, 0xA7, 0xF0, 0xA9, 0xF6,
         0xCB, 0xFA, 0x13, 0xF4, 0xA2, 0xF9, 0xC3, 0xED,
         0x31, 0xF5, 0xC7, 0xEF, 0x41, 0xEC, 0x40, 0xF2,
         0xFF, 0xE9, 0x9B, 0xF5, 0x3B, 0xF0, 0xDF, 0xF4,
         0x3C, 0x00, 0xDF, 0xF5, 0xC7, 0xF6, 0xAB, 0xE6,
         0xFA, 0xE6, 0xBC, 0xEC, 0x37, 0xE9, 0x0C, 0xEE,
         0xFD, 0xEA, 0x77, 0xFC, 0x1B, 0x04, 0xC2, 0xFF,
         0xE8, 0xFB, 0x81, 0xF3, 0x33, 0x02, 0x06, 0x02,
         0xC9, 0x07, 0x26, 0x0B, 0x13, 0x0D, 0x4C, 0x22,
         0x56, 0x1C, 0x90, 0x1E, 0xC5, 0x13, 0x7F, 0x09,
         0x01, 0x0E, 0x52, 0x03, 0x13, 0x0B, 0xFD, 0x08,
         0xC0, 0x0C, 0x65, 0x12, 0x01, 0x0B, 0x02, 0x0F,
         0x76, 0xFC, 0x86, 0xFA, 0x30, 0xF6, 0xE1, 0xF8,
         0xC2, 0x01, 0x39, 0xF9, 0x5F, 0x05, 0xC0, 0x05,
         0x25, 0x0E, 0xAC, 0x09, 0x7C, 0xFA, 0xB2, 0xFC,
         0x34, 0xFC, 0x68, 0x04, 0xE2, 0x03, 0xF2, 0x00,
         0x81, 0x07, 0xAB, 0x0D, 0x64, 0x0A, 0x76, 0x00,
         0x90, 0xFB, 0xAD, 0xFB, 0xA5, 0x06, 0x30, 0x01,
         0xF8, 0x03, 0xAB, 0x07, 0x1F, 0x11, 0x55, 0x17,
         0xDB, 0x08, 0xB4, 0x08, 0x74, 0x08, 0xCF, 0x11,
         0xC1, 0x14, 0x9C, 0x09, 0x74, 0x0D, 0xC7, 0x0F,
         0xDA, 0x15, 0xBB, 0x0C, 0x1B, 0xFD, 0x7A, 0xF5,
         0xE3, 0xF7, 0x17, 0xFD, 0x04, 0xFA, 0xDE, 0xF6,
         0xB7, 0xF4, 0x65, 0xFC, 0xA3, 0xFD, 0x45, 0xF8,
         0x82, 0xEE, 0xF5, 0xEC, 0x71, 0xF4, 0xFA, 0xFD,
         0x56, 0x03, 0x75, 0x03, 0xD5, 0x07, 0x3D, 0x07,
         0x70, 0x07, 0x4D, 0xFF, 0xF9, 0xF4, 0x95, 0xF3,
         0xBE, 0xF0, 0x88, 0xFD, 0x17, 0xFC, 0xB7, 0xFF,
         0x13, 0xFE, 0x88, 0xFA, 0x90, 0xFF, 0xC2, 0xF0,
         0xB0, 0xEF, 0x87, 0xEA, 0x4B, 0xF5, 0x06, 0x02,
         0xD8, 0x00, 0x06, 0x0B, 0x1B, 0x08, 0xB7, 0x10,
         0x5A, 0x08, 0x6E, 0xF9, 0x17, 0xF7, 0xC7, 0xEF,
         0x48, 0xFD, 0xF7, 0xF4, 0x95, 0xF7, 0xC2, 0xFA,
         0x6B, 0xFE, 0x2A, 0x02, 0x76, 0xEB, 0x78, 0xE7,
         0xE8, 0xE1, 0x31, 0xEB, 0x93, 0xF2, 0x93, 0xE8,
         0x85, 0xFA, 0x3C, 0xFD, 0x53, 0x0D, 0xE0, 0x08,
         0x04, 0xF7, 0x49, 0xFE, 0x48, 0xF5, 0xAF, 0x02,
         0x28, 0xF8, 0x57, 0xF7, 0xD7, 0x05, 0xBF, 0x00,
         0x6E, 0x0E, 0xE7, 0xFA, 0x06, 0xFC, 0x6B, 0xFC,
         0xDC, 0xF3, 0xDF, 0xFC, 0x48, 0xED, 0x41, 0xFD,
         0x0D, 0xFE, 0xE1, 0x05, 0x41, 0x0A, 0x01, 0xFF,
         0xB9, 0x08, 0xFC, 0xFB, 0x5D, 0x02, 0x65, 0xFD,
         0x0C, 0xFA, 0x62, 0x03, 0x29, 0xF8, 0x18, 0x05,
         0x2A, 0xFD, 0xBB, 0x03, 0x95, 0x01, 0x5B, 0xF7,
         0xE2, 0xFB, 0xE9, 0xF5, 0xB8, 0xFE, 0x7F, 0xFC,
         0x61, 0xFE, 0xF4, 0x02, 0xBE, 0x08, 0x2B, 0x0F,
         0x0C, 0x0E, 0x3D, 0x10, 0x23, 0x0E, 0x89, 0x13,
         0x99, 0x12, 0x3D, 0x12, 0xC8, 0x12, 0xAE, 0x10,
         0x18, 0x15, 0x14, 0x0F, 0xED, 0x13, 0x9D, 0x11,
         0xEA, 0x0B, 0x9A, 0x06, 0x85, 0xFE, 0x60, 0x04,
         0x36, 0x03, 0xCA, 0x07, 0x91, 0x04, 0x19, 0x02,
         0x8A, 0x0B, 0xFA, 0x06, 0xF4, 0x0A, 0x1A, 0x04,
         0xCB, 0xFE, 0x06, 0x04, 0xE0, 0xFB, 0x8E, 0x05,
         0x2B, 0xFC, 0xA5, 0xFE, 0xAA, 0x01, 0x56, 0xFB,
         0x40, 0x02, 0x6E, 0xF6, 0xC2, 0xF9, 0x02, 0xF9,
         0x59, 0xFA, 0x1D, 0x06, 0x6C, 0xFB, 0xA7, 0x04,
         0x5D, 0x01, 0x0A, 0x07, 0xCC, 0x0B, 0xC9, 0x02,
         0x39, 0x08, 0xFE, 0x02, 0xC5, 0x0C, 0xDC, 0x0A,
         0x2C, 0x05, 0x2F, 0x01, 0x84, 0xFF, 0x6A, 0x09,
         0xF8, 0x02, 0xE2, 0x01, 0x33, 0xF8, 0xD9, 0xFB,
         0x6E, 0xFE, 0x11, 0xF7, 0x0F, 0xF8, 0x28, 0xEE,
         0xD0, 0xF3, 0x1C, 0xF1, 0x4B, 0xF1, 0xB1, 0xF7,
         0x83, 0xF6, 0xDA, 0xFC, 0x54, 0xF4, 0x53, 0xF2,
         0xD8, 0xF3, 0xAD, 0xF7, 0x0F, 0xF7, 0xE4, 0xEC,
         0xC3, 0xF0, 0xD8, 0xF7, 0x76, 0x03, 0x77, 0x00,
         0xCC, 0xF2, 0xF4, 0xF1, 0x04, 0xF7, 0x0D, 0x00,
         0xAE, 0xF9, 0xCC, 0xED, 0x34, 0xF8, 0x1F, 0x05,
         0xA1, 0x0E, 0x56, 0x05, 0x29, 0xFA, 0xAC, 0xF8,
         0x0A, 0xFB, 0xC0, 0x04, 0xAB, 0x07, 0x55, 0x04,
         0xD5, 0x07, 0x4A, 0x0A, 0x9A, 0x16, 0x9E, 0x0E,
         0x0B, 0x07, 0x69, 0xFC, 0xE4, 0xFF, 0x8D, 0x0A,
         0xEF, 0xFF, 0x96, 0x03, 0x90, 0xF6, 0x82, 0x00,
         0x41, 0x05, 0x88, 0xFF, 0x09, 0xFE, 0x38, 0xE7,
         0x00, 0xF4, 0x55, 0xF5, 0x45, 0xFB, 0x1D, 0xF7,
         0x39, 0xEC, 0x7A, 0x03, 0x5C, 0xFD, 0x53, 0x0B,
         0xC4, 0xF7, 0xD2, 0xED, 0xEB, 0xFC, 0xB7, 0xF9,
         0x0E, 0x08, 0x5D, 0xF2, 0xC3, 0xF3, 0xA3, 0xFE,
         0xB8, 0x03, 0x64, 0x07, 0x93, 0xEC, 0xF6, 0xF1,
         0xA4, 0xF3, 0x79, 0xFF, 0x50, 0x01, 0xDC, 0xF5,
         0x32, 0xFF, 0x98, 0x04, 0x85, 0x13, 0x2F, 0x09,
         0xF6, 0x02, 0xB2, 0x05, 0xA6, 0x13, 0xB8, 0x1B,
         0xE3, 0x0B, 0xCD, 0x01, 0xB0, 0x00, 0xE7, 0x0C,
         0x5E, 0x0D, 0xCA, 0x01, 0x2E, 0xF8, 0x90, 0xF8,
         0xA5, 0x08, 0x25, 0xFC, 0x0B, 0xF6, 0x8F, 0xEC,
         0xF2, 0xF1, 0xCA, 0xFC, 0xBE, 0x00, 0x4D, 0x08,
         0x44, 0x05, 0x0F, 0x04, 0xFA, 0xFC, 0x13, 0xFE,
         0xCA, 0x03, 0xA8, 0x14, 0x89, 0x20, 0x0E, 0x1A,
         0x49, 0x1B, 0x0A, 0x03, 0xD9, 0xF6, 0x97, 0xF1,
         0xA7, 0xE5, 0x6B, 0xE8, 0x96, 0xF9, 0x30, 0x07,
         0x0D, 0x0C, 0xE3, 0x02, 0x06, 0x04, 0x8D, 0x06,
         0x0B, 0x06, 0xB8, 0x12, 0xCC, 0x0D, 0x95, 0x10,
         0x64, 0x0A, 0xF2, 0x13, 0xF3, 0x16, 0x89, 0x11,
         0xC1, 0x0F, 0x5D, 0x00, 0xE6, 0x0F, 0x6E, 0x13,
         0xA3, 0x18, 0xC8, 0x05, 0xF2, 0xF1, 0x2E, 0xF8,
         0xF5, 0xF1, 0x67, 0xF8, 0x32, 0xEC, 0xE2, 0xEA,
         0x05, 0xF6, 0x2F, 0xF3, 0xFE, 0xF3, 0x45, 0xEE,
         0x65, 0xF5, 0x92, 0x08, 0x3C, 0x0B, 0x69, 0x0D,
         0x3B, 0x0C, 0x62, 0x0D, 0x39, 0x0A, 0xAE, 0x01,
         0xEB, 0xF7, 0x46, 0xED, 0xFF, 0xE9, 0x86, 0xE5,
         0x82, 0xEA, 0xD8, 0xEF, 0x97, 0xF7, 0xD1, 0xF9,
         0xDC, 0xF7, 0x91, 0xF9, 0x1E, 0xF8, 0xA8, 0xFE,
         0xCD, 0xFD, 0x67, 0xFD, 0xD6, 0x00, 0x3E, 0x0A,
         0xF2, 0x0D, 0x32, 0x07, 0xA4, 0xFF, 0x7D, 0xFC,
         0x97, 0x08, 0x48, 0x09, 0x39, 0x03, 0xDC, 0xFB,
         0x47, 0xF8, 0x34, 0x00, 0x73, 0x02, 0x5B, 0x04,
         0xD1, 0x04, 0x9B, 0x03, 0xE3, 0x06, 0xBC, 0x0C,
         0xB7, 0x09, 0x39, 0x00, 0xFB, 0xFC, 0x8E, 0xFF,
         0x4A, 0x10, 0x75, 0x0E, 0x33, 0x09, 0x9D, 0x00,
         0x0C, 0x01, 0x4D, 0x07, 0xA6, 0xFB, 0x02, 0xF4,
         0xA0, 0xE9, 0x56, 0xF5, 0x18, 0xFC, 0x93, 0xFA,
         0x4B, 0xF9, 0x19, 0xF3, 0xB5, 0x05, 0xE9, 0x02,
         0xE6, 0x02, 0xE4, 0xF5, 0xAB, 0xF2, 0xF0, 0x06,
         0xAE, 0x04, 0x18, 0x0A, 0xC8, 0xFB, 0x95, 0xFE,
         0xF8, 0x06, 0xC0, 0xFF, 0x4D, 0xFA, 0x02, 0xE7,
         0x4A, 0xEC, 0xD6, 0xF3, 0xA7, 0xF9, 0xF1, 0xF6,
         0x32, 0xEE, 0xF8, 0xF5, 0x96, 0xFF, 0x98, 0x06,
         0x23, 0xFE, 0x21, 0xFE, 0x4C, 0xFD, 0xD1, 0x06,
         0x3C, 0x06, 0x39, 0xFF, 0xE4, 0x03, 0x11, 0x00,
         0x20, 0x0C, 0x07, 0x05, 0x34, 0xFC, 0x62, 0xF6,
         0x3F, 0xEC, 0x8B, 0xF3, 0x7A, 0xEA, 0x1D, 0xE5,
         0x09, 0xE5, 0x9D, 0xE9, 0x03, 0xFB, 0x54, 0xFF,
         0x0C, 0x02, 0x9A, 0x02, 0x25, 0x01, 0xF8, 0x04,
         0x7F, 0xFF, 0x0A, 0xFD, 0x35, 0x00, 0x53, 0xFF,
         0x3E, 0x0D, 0x95, 0x0E, 0x21, 0x11, 0x8A, 0x0A,
         0x3F, 0xFB, 0x87, 0xFC, 0xD8, 0xF5, 0x6E, 0xFD,
         0xD9, 0xFA, 0xB4, 0xFB, 0xBD, 0x09, 0x8B, 0x13,
         0xB0, 0x1E, 0xB4, 0x12, 0x41, 0x0E, 0x77, 0x06,
         0x43, 0x0D, 0xFE, 0x12, 0xDC, 0x10, 0xFB, 0x18,
         0xD1, 0x15, 0xC0, 0x1F, 0xFA, 0x18, 0xD9, 0x10,
         0x6A, 0x08, 0xC2, 0xFE, 0xE4, 0x02, 0xA1, 0xFA,
         0xC8, 0x03, 0x31, 0x04, 0xC2, 0x08, 0xA7, 0x07,
         0x93, 0x01, 0xA3, 0x05, 0xB9, 0xFD, 0xC5, 0x02,
         0x77, 0xFB, 0x9A, 0x02, 0xE2, 0x0B, 0x3F, 0x0E,
         0x90, 0x13, 0x2B, 0x08, 0xEE, 0x09, 0x34, 0x03,
         0x7A, 0x04, 0x56, 0xFE, 0xE8, 0xFC, 0x50, 0x03,
         0x40, 0xFE, 0x5C, 0x02, 0x21, 0xF8, 0x84, 0xFC,
         0x0B, 0xF5, 0x11, 0xEE, 0xBC, 0xF1, 0x13, 0xF0,
         0x12, 0x00, 0x19, 0xFB, 0xAC, 0xF8, 0x59, 0xF8,
         0xD4, 0xF7, 0x1C, 0xFC, 0x7A, 0xF1, 0x30, 0xEC,
         0xAA, 0xEF, 0x1C, 0xFC, 0x4C, 0x01, 0x0B, 0xFE,
         0xF8, 0xF1, 0x87, 0xF3, 0x93, 0xF7, 0x33, 0xF5,
         0x6A, 0xF2, 0xFA, 0xE1, 0xAE, 0xF1, 0x40, 0xF8,
         0xF8, 0x01, 0x7F, 0x04, 0x1B, 0xF3, 0xBE, 0xFE,
         0x66, 0xF5, 0x7E, 0xF5, 0xCD, 0xEF, 0x4B, 0xE8,
         0xCB, 0xFD, 0xA2, 0xFD, 0x31, 0x08, 0x55, 0x05,
         0x3C, 0x02, 0x95, 0x09, 0x64, 0xFD, 0x36, 0xFA,
         0x0C, 0xF4, 0x16, 0xF8, 0x94, 0x00, 0xBE, 0xFD,
         0xC4, 0xFB, 0x2D, 0xFB, 0x14, 0x00, 0x12, 0x03,
         0xF0, 0xFC, 0x79, 0xF2, 0x7B, 0xF4, 0x6B, 0xFC,
         0xA0, 0x00, 0x12, 0x02, 0x78, 0xFD, 0x2E, 0x07,
         0xDA, 0x0D, 0x2C, 0x13, 0x6B, 0x13, 0xB8, 0x09,
         0x6E, 0x11, 0xBB, 0x0E, 0x21, 0x10, 0xB9, 0x0E,
         0x99, 0x05, 0x48, 0x0D, 0x60, 0x05, 0x4E, 0x0E,
         0x70, 0x0C, 0xD7, 0x05, 0x30, 0x08, 0x66, 0xFB,
         0x07, 0x07, 0xFD, 0x00, 0x66, 0xFF, 0x54, 0x01,
         0xC7, 0x01, 0x22, 0x13, 0xC1, 0x0F, 0xB0, 0x0F,
         0xE7, 0x08, 0xF1, 0x05, 0x26, 0x08, 0x9A, 0xFD,
         0xB2, 0xF9, 0x31, 0xF2, 0x74, 0xF8, 0xEB, 0xF9,
         0xD5, 0xF8, 0xA7, 0xF5, 0xAC, 0xF2, 0xE4, 0xF7,
         0x7D, 0xF1, 0x8F, 0xF2, 0x9B, 0xEE, 0xA9, 0xF7,
         0x09, 0x00, 0xE8, 0xFD, 0xFA, 0x04, 0x99, 0x03,
         0x98, 0x0E, 0xA4, 0x0A, 0x41, 0x05, 0x5B, 0x03,
         0x23, 0xFF, 0xCB, 0x04, 0x7D, 0xFB, 0x63, 0xFD,
         0xB7, 0xF9, 0x43, 0xFC, 0xCC, 0xFD, 0x0E, 0xFD,
         0xEA, 0x04, 0x27, 0xFF, 0x87, 0x04, 0x04, 0xFF,
         0xAB, 0x02, 0x02, 0x09, 0xDE, 0x03, 0xEE, 0x06,
         0x84, 0x00, 0x87, 0x0E, 0x07, 0x11, 0x5B, 0x0A,
         0x63, 0x02, 0x9E, 0xF5, 0x89, 0xFA, 0x58, 0xF5,
         0xAD, 0xED, 0xD7, 0xE3, 0xFA, 0xE4, 0x0F, 0xF1,
         0xED, 0xF7, 0x59, 0xF7, 0x6F, 0xF5, 0xDB, 0xFC,
         0xD7, 0x00, 0x39, 0x02, 0x7F, 0xFA, 0xFA, 0xFC,
         0x07, 0x08, 0xE8, 0x0A, 0xB3, 0x0D, 0x4D, 0x0A,
         0x9C, 0x17, 0x46, 0x18, 0x9A, 0x0D, 0x0E, 0xFE,
         0xC5, 0xF5, 0xD0, 0x04, 0x7F, 0x05, 0xB2, 0x03,
         0xD9, 0xF7, 0x24, 0x01, 0xBE, 0x13, 0x3A, 0x13,
         0x38, 0x11, 0xF5, 0xF8, 0x0F, 0x04, 0x16, 0x09,
         0x7B, 0x05, 0x37, 0x06, 0x5E, 0xF3, 0xFC, 0x0A,
         0x47, 0x0A, 0xB5, 0x09, 0xA8, 0x01, 0x48, 0xE9,
         0x49, 0xF2, 0x6C, 0xE1, 0x6B, 0xE6, 0xCB, 0xE2,
         0x6F, 0xE0, 0x24, 0xF1, 0x6B, 0xED, 0x59, 0xFD,
         0xC0, 0xFB, 0x00, 0xF6, 0x22, 0xEF, 0xF1, 0xE9,
         0x8F, 0xF8, 0x84, 0xFC, 0xED, 0x00, 0xAB, 0xFE,
         0x13, 0x0A, 0xF3, 0x14, 0xFC, 0x14, 0xDD, 0x05,
         0x40, 0xF7, 0x7E, 0xFF, 0x89, 0x02, 0x59, 0x0A,
         0x4A, 0x03, 0xA8, 0x07, 0xB2, 0x16, 0x40, 0x18,
         0xA1, 0x17, 0x5D, 0x01, 0xA3, 0x02, 0x52, 0x02,
         0xF7, 0xFE, 0xEA, 0x02, 0x88, 0xFD, 0x2D, 0x0B,
         0x72, 0x0C, 0x08, 0x05, 0x2E, 0xFE, 0x5A, 0xF5,
         0x8B, 0xF9, 0x79, 0xF8, 0xA2, 0xF7, 0x63, 0xF9,
         0xA2, 0x03, 0xE8, 0x0B, 0x16, 0x0B, 0x5D, 0x01,
         0x31, 0xFA, 0x8C, 0xFC, 0xF5, 0xF8, 0x47, 0xF6,
         0xD5, 0xF0, 0x58, 0xF5, 0xB0, 0x04, 0x2E, 0x07,
         0x0A, 0x05, 0xAF, 0xFB, 0xE3, 0xFB, 0xF5, 0x03,
         0xD3, 0x05, 0x02, 0x08, 0xD4, 0x0A, 0x7A, 0x13,
         0x28, 0x21, 0x77, 0x26, 0x6B, 0x22, 0x91, 0x1A,
         0x1C, 0x0F, 0x2C, 0x0A, 0x57, 0x06, 0x01, 0xFF,
         0x63, 0xFB, 0x82, 0xFC, 0xB1, 0x05, 0x5C, 0x0B,
         0x19, 0x05, 0x09, 0xFC, 0xD4, 0xF3, 0x6E, 0xF3,
         0xB1, 0xF4, 0xD2, 0xF5, 0xC3, 0xF6, 0xE9, 0xFE,
         0xB1, 0x07, 0x8B, 0x0E, 0xE7, 0x0A, 0x71, 0xFF,
         0x16, 0xFA, 0xB6, 0xF5, 0x60, 0xF0, 0x0D, 0xE4,
         0x7B, 0xDB, 0x76, 0xE2, 0x6F, 0xEA, 0x0E, 0xEE,
         0x56, 0xE3, 0x21, 0xDC, 0x25, 0xE2, 0x6F, 0xE4,
         0xA4, 0xEA, 0x70, 0xE6, 0x5C, 0xED, 0x69, 0xFF,
         0xC6, 0x07, 0x7C, 0x0F, 0x12, 0x0A, 0xED, 0x0A,
         0x4A, 0x10, 0xD0, 0x07, 0x97, 0x05, 0x1A, 0xFE,
         0x07, 0xFE, 0x44, 0xFC, 0x28, 0xF3, 0xF5, 0xF4,
         0x49, 0xF8, 0x43, 0xFA, 0xE6, 0xF4, 0x16, 0xF0,
         0x09, 0xF5, 0x7F, 0xFB, 0xB7, 0xFE, 0x7A, 0xFB,
         0x27, 0x02, 0x51, 0x0D, 0x15, 0x13, 0x77, 0x10,
         0xB9, 0x08, 0x2A, 0x06, 0x13, 0x09, 0xC9, 0x06,
         0xB3, 0x00, 0xDB, 0xFB, 0x8D, 0xF9, 0x82, 0xFD,
         0xE6, 0xFC, 0x2B, 0xFC, 0x00, 0xFD, 0xCD, 0xFD,
         0x30, 0x00, 0xB2, 0xFF, 0xA8, 0xFF, 0x0A, 0x00,
         0xFF, 0xFF, 0xBC, 0x0C, 0xC8, 0x0B, 0x52, 0x0F,
         0x3D, 0x10, 0xE2, 0x0E, 0x37, 0x0D, 0x4B, 0x07,
         0xC6, 0x09, 0x18, 0x09, 0xB9, 0x08, 0x73, 0x06,
         0x46, 0x04, 0x0F, 0x09, 0x58, 0x07, 0xE9, 0x04,
         0x20, 0x00, 0xBE, 0xFF, 0x46, 0x05, 0x64, 0x05,
         0x4D, 0x06, 0x8B, 0x07, 0x77, 0x0C, 0xC6, 0x10,
         0x52, 0x0C, 0xA2, 0x06, 0x0B, 0x04, 0x1A, 0x04,
         0xBC, 0x03, 0x74, 0xFE, 0x16, 0xFC, 0xC6, 0x00,
         0x3D, 0x04, 0xF2, 0x04, 0x65, 0xFE, 0xBF, 0xF9,
         0xBF, 0xFA, 0x3C, 0xF9, 0x42, 0xF9, 0xBF, 0xF5,
         0xC2, 0xF7, 0x68, 0xFD, 0xB0, 0xFF, 0xFB, 0x01,
         0x71, 0xFD, 0xE5, 0xFA, 0xE8, 0xF7, 0x27, 0xF5,
         0x28, 0xF5, 0xFA, 0xF2, 0x23, 0xF4, 0x29, 0xF6,
         0xFE, 0xF9, 0x1E, 0xFC, 0x22, 0xFA, 0x6F, 0xF6,
         0x83, 0xF5, 0xC0, 0xF6, 0x93, 0xF6, 0xC5, 0xF5,
         0x20, 0xF4, 0x91, 0xF9, 0xD9, 0xFC, 0x96, 0xFC,
         0xF3, 0xF8, 0x37, 0xF4, 0x9C, 0xF7, 0xAF, 0xF6,
         0xDB, 0xF6, 0x75, 0xF4, 0x89, 0xF5, 0x64, 0xFB,
         0x20, 0xFB, 0x28, 0xFD, 0x3A, 0xFA, 0x23, 0xFD,
         0x92, 0xFE, 0x9D, 0xFD, 0x9C, 0x00, 0xA9, 0xFF,
         0x4E, 0x04, 0xBA, 0x00, 0x85, 0xFE, 0xED, 0xFD,
         0x2B, 0xFD, 0xBB, 0xFF, 0x94, 0xFA, 0xC2, 0xFB,
         0x0D, 0xFC, 0xBF, 0x00, 0x51, 0x01, 0xF0, 0xFC,
         0xFC, 0xFD, 0x25, 0xFC, 0xF5, 0x03, 0xE0, 0x02,
         0xD7, 0x04, 0x9F, 0x08, 0x53, 0x08, 0xD8, 0x0F,
         0xA9, 0x08, 0xD9, 0x08, 0x0C, 0x06, 0xFF, 0x02,
         0xD8, 0x06, 0x7C, 0x00, 0x13, 0x06, 0xB0, 0x06,
         0x13, 0x08, 0x38, 0x08, 0x6E, 0x01, 0xC3, 0x03,
         0x14, 0x03, 0xFF, 0x04, 0x52, 0x04, 0x0D, 0x05,
         0x75, 0x0B, 0x8B, 0x11, 0x76, 0x13, 0x94, 0x0F,
         0x64, 0x0C, 0x19, 0x0A, 0x9F, 0x0B, 0x14, 0x07,
         0x65, 0x05, 0x87, 0x04, 0x51, 0x06, 0xA0, 0x0A,
         0x90, 0x05, 0x6F, 0x06, 0xF4, 0xFF, 0x70, 0xFF,
         0x73, 0xFD, 0xA8, 0xF9, 0x58, 0x00, 0x99, 0xFD,
         0xBF, 0x04, 0x83, 0x02, 0x59, 0x04, 0x68, 0x08,
         0x3A, 0x02, 0x73, 0x03, 0xB1, 0xF9, 0x84, 0xFD,
         0xC4, 0xFD, 0x9D, 0xFD, 0x69, 0xFE, 0x2D, 0xF8,
         0x32, 0xFF, 0x77, 0xFA, 0xD9, 0xFC, 0xB3, 0xF6,
         0x34, 0xF3, 0x30, 0xF9, 0xD7, 0xF4, 0xF9, 0xFC,
         0xB9, 0xF7, 0xA0, 0xFB, 0x75, 0xFF, 0x29, 0xFC,
         0x6A, 0x01, 0x79, 0xFA,
     };

__align(2)
     const U8 Copter_background_midi[1063] = 
     {
         0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06,
         0x00, 0x00, 0x00, 0x01, 0x03, 0xC0, 0x4D, 0x54,
         0x72, 0x6B, 0x00, 0x00, 0x04, 0x11, 0x00, 0xFF,
         0x02, 0x16, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69,
         0x67, 0x68, 0x74, 0x20, 0x63, 0x20, 0x32, 0x30,
         0x30, 0x33, 0x20, 0x62, 0x79, 0x20, 0x43, 0x43,
         0x00, 0xFF, 0x01, 0x02, 0x43, 0x43, 0x00, 0xFF,
         0x58, 0x04, 0x04, 0x02, 0x18, 0x08, 0x00, 0xFF,
         0x59, 0x02, 0x00, 0x00, 0x00, 0xFF, 0x51, 0x03,
         0x09, 0x27, 0xC0, 0x00, 0xC0, 0x56, 0x00, 0xB0,
         0x07, 0x66, 0x00, 0x90, 0x4A, 0x6F, 0x00, 0x48,
         0x67, 0x00, 0x43, 0x7C, 0x81, 0x70, 0x48, 0x00,
         0x00, 0x4A, 0x00, 0x00, 0x48, 0x52, 0x00, 0x4A,
         0x53, 0x81, 0x70, 0x4A, 0x00, 0x00, 0x48, 0x00,
         0x00, 0x43, 0x00, 0x00, 0x4A, 0x52, 0x00, 0x48,
         0x51, 0x00, 0x43, 0x7D, 0x81, 0x70, 0x48, 0x00,
         0x00, 0x4A, 0x00, 0x00, 0x4A, 0x6F, 0x00, 0x48,
         0x5A, 0x81, 0x70, 0x48, 0x00, 0x00, 0x4A, 0x00,
         0x00, 0x48, 0x52, 0x00, 0x4A, 0x52, 0x81, 0x70,
         0x4A, 0x00, 0x00, 0x48, 0x00, 0x00, 0x48, 0x53,
         0x00, 0x4A, 0x53, 0x81, 0x70, 0x4A, 0x00, 0x00,
         0x48, 0x00, 0x00, 0x43, 0x00, 0x00, 0x48, 0x53,
         0x00, 0x4A, 0x67, 0x00, 0x43, 0x7C, 0x81, 0x70,
         0x4A, 0x00, 0x00, 0x48, 0x00, 0x00, 0x4A, 0x67,
         0x00, 0x48, 0x5A, 0x81, 0x70, 0x48, 0x00, 0x00,
         0x4A, 0x00, 0x00, 0x43, 0x00, 0x00, 0x4C, 0x6F,
         0x00, 0x4A, 0x6F, 0x00, 0x45, 0x7D, 0x81, 0x70,
         0x4A, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x4C, 0x51,
         0x00, 0x4A, 0x50, 0x81, 0x70, 0x4A, 0x00, 0x00,
         0x4C, 0x00, 0x00, 0x45, 0x00, 0x00, 0x4C, 0x53,
         0x00, 0x4A, 0x51, 0x00, 0x45, 0x7D, 0x81, 0x70,
         0x4A, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x4C, 0x67,
         0x00, 0x4A, 0x5A, 0x81, 0x70, 0x4A, 0x00, 0x00,
         0x4C, 0x00, 0x00, 0x4C, 0x53, 0x00, 0x4A, 0x51,
         0x81, 0x70, 0x4A, 0x00, 0x00, 0x4C, 0x00, 0x00,
         0x4A, 0x48, 0x00, 0x4C, 0x51, 0x81, 0x70, 0x4C,
         0x00, 0x00, 0x4A, 0x00, 0x00, 0x45, 0x00, 0x00,
         0x4C, 0x6F, 0x00, 0x4A, 0x67, 0x00, 0x45, 0x6F,
         0x81, 0x70, 0x4A, 0x00, 0x00, 0x4C, 0x00, 0x00,
         0x4C, 0x53, 0x00, 0x4A, 0x53, 0x81, 0x70, 0x4A,
         0x00, 0x00, 0x4C, 0x00, 0x00, 0x45, 0x00, 0x00,
         0x4A, 0x67, 0x00, 0x48, 0x67, 0x00, 0x43, 0x7D,
         0x81, 0x70, 0x48, 0x00, 0x00, 0x4A, 0x00, 0x00,
         0x4A, 0x53, 0x00, 0x48, 0x51, 0x81, 0x70, 0x48,
         0x00, 0x00, 0x4A, 0x00, 0x00, 0x43, 0x00, 0x00,
         0x4A, 0x52, 0x00, 0x48, 0x51, 0x00, 0x43, 0x7C,
         0x81, 0x70, 0x48, 0x00, 0x00, 0x4A, 0x00, 0x00,
         0x4A, 0x67, 0x00, 0x48, 0x5A, 0x81, 0x70, 0x48,
         0x00, 0x00, 0x4A, 0x00, 0x00, 0x48, 0x49, 0x00,
         0x4A, 0x50, 0x81, 0x70, 0x4A, 0x00, 0x00, 0x48,
         0x00, 0x00, 0x4A, 0x52, 0x00, 0x48, 0x49, 0x81,
         0x70, 0x48, 0x00, 0x00, 0x4A, 0x00, 0x00, 0x43,
         0x00, 0x00, 0x4A, 0x6F, 0x00, 0x48, 0x67, 0x00,
         0x43, 0x7C, 0x81, 0x70, 0x48, 0x00, 0x00, 0x4A,
         0x00, 0x00, 0x4A, 0x41, 0x00, 0x48, 0x41, 0x81,
         0x70, 0x48, 0x00, 0x00, 0x4A, 0x00, 0x00, 0x43,
         0x00, 0x00, 0x4C, 0x6F, 0x00, 0x4A, 0x67, 0x00,
         0x45, 0x7D, 0x81, 0x70, 0x4A, 0x00, 0x00, 0x4C,
         0x00, 0x00, 0x4C, 0x50, 0x00, 0x4A, 0x49, 0x81,
         0x70, 0x4A, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x45,
         0x00, 0x00, 0x4C, 0x53, 0x00, 0x4A, 0x52, 0x00,
         0x45, 0x7D, 0x81, 0x70, 0x4A, 0x00, 0x00, 0x4C,
         0x00, 0x00, 0x4C, 0x67, 0x00, 0x4A, 0x5A, 0x81,
         0x70, 0x4A, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x4C,
         0x5A, 0x00, 0x4A, 0x51, 0x81, 0x70, 0x4A, 0x00,
         0x00, 0x4C, 0x00, 0x00, 0x4C, 0x53, 0x00, 0x4A,
         0x52, 0x81, 0x70, 0x4A, 0x00, 0x00, 0x4C, 0x00,
         0x00, 0x45, 0x00, 0x00, 0x4C, 0x6F, 0x00, 0x4A,
         0x67, 0x00, 0x45, 0x7D, 0x81, 0x70, 0x4A, 0x00,
         0x00, 0x4C, 0x00, 0x00, 0x4A, 0x67, 0x00, 0x4C,
         0x6F, 0x81, 0x70, 0x4C, 0x00, 0x00, 0x4A, 0x00,
         0x00, 0x45, 0x00, 0x00, 0x4B, 0x7C, 0x00, 0x4D,
         0x67, 0x00, 0x46, 0x7F, 0x81, 0x70, 0x4D, 0x00,
         0x00, 0x4B, 0x00, 0x00, 0x4D, 0x50, 0x00, 0x4B,
         0x67, 0x81, 0x70, 0x4B, 0x00, 0x00, 0x4D, 0x00,
         0x00, 0x46, 0x00, 0x00, 0x4D, 0x5A, 0x00, 0x4B,
         0x7C, 0x00, 0x46, 0x7F, 0x81, 0x70, 0x4B, 0x00,
         0x00, 0x4D, 0x00, 0x00, 0x4D, 0x53, 0x00, 0x4B,
         0x6F, 0x81, 0x70, 0x4B, 0x00, 0x00, 0x4D, 0x00,
         0x00, 0x4D, 0x53, 0x00, 0x4B, 0x6F, 0x81, 0x70,
         0x4B, 0x00, 0x00, 0x4D, 0x00, 0x00, 0x4B, 0x67,
         0x00, 0x4D, 0x51, 0x81, 0x70, 0x4D, 0x00, 0x00,
         0x4B, 0x00, 0x00, 0x46, 0x00, 0x00, 0x4D, 0x5A,
         0x00, 0x4B, 0x7C, 0x00, 0x46, 0x7D, 0x81, 0x70,
         0x4B, 0x00, 0x00, 0x4D, 0x00, 0x00, 0x4D, 0x5A,
         0x00, 0x4B, 0x7C, 0x81, 0x70, 0x4B, 0x00, 0x00,
         0x4D, 0x00, 0x00, 0x46, 0x00, 0x00, 0x4F, 0x6F,
         0x00, 0x4D, 0x67, 0x00, 0x48, 0x6F, 0x81, 0x70,
         0x4D, 0x00, 0x00, 0x4F, 0x00, 0x00, 0x4F, 0x51,
         0x00, 0x4D, 0x53, 0x81, 0x70, 0x4D, 0x00, 0x00,
         0x4F, 0x00, 0x00, 0x48, 0x00, 0x00, 0x4F, 0x67,
         0x00, 0x4D, 0x67, 0x00, 0x48, 0x7D, 0x81, 0x70,
         0x4D, 0x00, 0x00, 0x4F, 0x00, 0x00, 0x4F, 0x5A,
         0x00, 0x4D, 0x67, 0x81, 0x70, 0x4D, 0x00, 0x00,
         0x4F, 0x00, 0x00, 0x4F, 0x53, 0x00, 0x4D, 0x52,
         0x81, 0x70, 0x4D, 0x00, 0x00, 0x4F, 0x00, 0x00,
         0x4F, 0x53, 0x00, 0x4D, 0x53, 0x81, 0x70, 0x4D,
         0x00, 0x00, 0x4F, 0x00, 0x00, 0x48, 0x00, 0x00,
         0x4F, 0x5A, 0x00, 0x4D, 0x5A, 0x00, 0x48, 0x6F,
         0x81, 0x70, 0x4D, 0x00, 0x00, 0x4F, 0x00, 0x00,
         0x4F, 0x53, 0x00, 0x4D, 0x5A, 0x81, 0x70, 0x4D,
         0x00, 0x00, 0x4F, 0x00, 0x00, 0x48, 0x00, 0x00,
         0x4D, 0x52, 0x00, 0x4B, 0x5A, 0x00, 0x46, 0x7F,
         0x81, 0x70, 0x4B, 0x00, 0x00, 0x4D, 0x00, 0x00,
         0x4D, 0x52, 0x00, 0x4B, 0x67, 0x81, 0x70, 0x4B,
         0x00, 0x00, 0x4D, 0x00, 0x00, 0x46, 0x00, 0x00,
         0x4D, 0x52, 0x00, 0x4B, 0x67, 0x00, 0x46, 0x7F,
         0x81, 0x70, 0x4B, 0x00, 0x00, 0x4D, 0x00, 0x00,
         0x4D, 0x53, 0x00, 0x4B, 0x67, 0x81, 0x70, 0x4B,
         0x00, 0x00, 0x4D, 0x00, 0x00, 0x4D, 0x51, 0x00,
         0x4B, 0x6F, 0x81, 0x70, 0x4B, 0x00, 0x00, 0x4D,
         0x00, 0x00, 0x4D, 0x50, 0x00, 0x4B, 0x67, 0x81,
         0x70, 0x4B, 0x00, 0x00, 0x4D, 0x00, 0x00, 0x46,
         0x00, 0x00, 0x4D, 0x53, 0x00, 0x4B, 0x6F, 0x00,
         0x46, 0x7F, 0x81, 0x70, 0x4B, 0x00, 0x00, 0x4D,
         0x00, 0x00, 0x4D, 0x51, 0x00, 0x4B, 0x53, 0x81,
         0x70, 0x4B, 0x00, 0x00, 0x4D, 0x00, 0x00, 0x46,
         0x00, 0x00, 0x4F, 0x5A, 0x00, 0x4D, 0x5A, 0x00,
         0x48, 0x7C, 0x81, 0x70, 0x4D, 0x00, 0x00, 0x4F,
         0x00, 0x00, 0x4F, 0x52, 0x00, 0x4D, 0x52, 0x81,
         0x70, 0x4D, 0x00, 0x00, 0x4F, 0x00, 0x00, 0x48,
         0x00, 0x00, 0x4F, 0x51, 0x00, 0x4D, 0x51, 0x00,
         0x48, 0x7D, 0x81, 0x70, 0x4D, 0x00, 0x00, 0x4F,
         0x00, 0x00, 0x4D, 0x52, 0x00, 0x4F, 0x50, 0x81,
         0x70, 0x4F, 0x00, 0x00, 0x4D, 0x00, 0x00, 0x4D,
         0x52, 0x00, 0x4F, 0x50, 0x81, 0x70, 0x4F, 0x00,
         0x00, 0x4D, 0x00, 0x00, 0x4F, 0x50, 0x00, 0x4D,
         0x51, 0x81, 0x70, 0x4D, 0x00, 0x00, 0x4F, 0x00,
         0x00, 0x48, 0x00, 0x00, 0x4F, 0x51, 0x00, 0x4D,
         0x51, 0x00, 0x48, 0x7C, 0x81, 0x70, 0x4D, 0x00,
         0x00, 0x4F, 0x00, 0x00, 0x4F, 0x53, 0x00, 0x4D,
         0x52, 0x81, 0x70, 0x4D, 0x00, 0x00, 0x4F, 0x00,
         0x00, 0x48, 0x00, 0x00, 0xFF, 0x2F, 0x00,
     };

 #endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 

/******************************************AUDIO************************************/


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_enter_gfx
 * DESCRIPTION
 *  Set Game Framework (GFX) Parameter
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
/* keep this game old naming style */
void mmi_gx_copter_enter_gfx(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Game menu */
    GFX.game_data.game_img_id = IMG_ID_GX_COPTER_GAME_ICON; /* game icon img ID */
#if defined(__MMI_GAME_COPTER__)
    GFX.game_data.game_str_id = STR_ID_GX_COPTER_GAME_NAME; /* game name string ID */
#elif defined(__MMI_GAME_SUBMARINE__)
    GFX.game_data.game_str_id = STR_ID_GX_COPTER_GAME_NAME_SUBMARINE;   /* game name string ID */
#elif defined(__MMI_GAME_JET__)
    GFX.game_data.game_str_id = STR_ID_GX_COPTER_GAME_NAME_JET; /* game name string ID */
#endif 
    GFX.game_data.menu_resume_str_id = STR_GAME_RESUME;     /* "Resume" string ID */
    GFX.game_data.menu_new_str_id = STR_GAME_NEW;           /* "New Game" string ID */
    GFX.game_data.menu_level_str_id = 0;                    /* "Game Level" string ID */
    GFX.game_data.menu_grade_str_id = STR_GAME_GRADE;       /* "Best Grade" string ID */
    GFX.game_data.menu_help_str_id = STR_GLOBAL_HELP;         /* "Game Help" string ID */

    /* level / grade */
    GFX.game_data.level_count = 1;                          /* how many levels */
    GFX.game_data.level_str_id_list[0] = STR_GAME_SCORE;    /* level string ID */

    /* add slot in NVRAMEnum.h */
    GFX.game_data.grade_nvram_id_list[0] = NVRAM_GX_COPTER_SCORE;       /* grade slot in NVRAM (short) */

    /* help */
#if defined(__MMI_TOUCH_SCREEN__)
#if defined(__MMI_GAME_COPTER__)
    GFX.game_data.help_str_id = STR_ID_GX_COPTER_HELP_DESCRIPTION_TP;   /* help desciption string id */
#elif defined(__MMI_GAME_SUBMARINE__)
    GFX.game_data.help_str_id = STR_ID_GX_COPTER_HELP_DESCRIPTION_SUBMARINE_TP; /* help desciption string id */
#elif defined(__MMI_GAME_JET__) 
    GFX.game_data.help_str_id = STR_ID_GX_COPTER_HELP_DESCRIPTION_JET_TP;       /* help desciption string id */
#endif 
#else /* defined(__MMI_TOUCH_SCREEN__) */ 
#if defined(__MMI_GAME_COPTER__) 
    GFX.game_data.help_str_id = STR_ID_GX_COPTER_HELP_DESCRIPTION;      /* help desciption string id */
#elif defined(__MMI_GAME_SUBMARINE__)
    GFX.game_data.help_str_id = STR_ID_GX_COPTER_HELP_DESCRIPTION_SUBMARINE;    /* help desciption string id */
#elif defined(__MMI_GAME_JET__)
    GFX.game_data.help_str_id = STR_ID_GX_COPTER_HELP_DESCRIPTION_JET;  /* help desciption string id */
#endif 
#endif /* defined(__MMI_TOUCH_SCREEN__) */ 

    /* misc */
    GFX.game_data.grade_value_ptr = (S16*) (&g_gx_copter_context.game_grade);  /* current level's grade (S16*) */
    GFX.game_data.level_index_ptr = (U8*) (&g_gx_copter_context.game_level);   /* ptr to current level index (U8*) */
    GFX.game_data.is_new_game = (BOOL*) (&g_gx_copter_context.is_new_game);    /* ptr to new game flag (BOOL*) */

    /* function ptr */
    GFX.game_data.best_grade_func_ptr = mmi_gx_copter_calc_best_grade;  /* function to calculate best grade */
    GFX.game_data.enter_game_func_ptr = mmi_gx_copter_enter_game;       /* function to enter new game */
    GFX.game_data.exit_game_func_ptr = mmi_gx_copter_exit_game; /* function to exit game */
    GFX.game_data.draw_gameover_func_ptr = mmi_gx_copter_draw_gameover; /* function to draw gameover screen */

    /* some flags */
    GFX.game_data.is_keypad_audio_enable = FALSE;   /* play keypad tone or not */

    mmi_gfx_entry_menu_screen();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_calc_best_grade
 * DESCRIPTION
 *  Calculate new best grade [Callback required by GFX]
 * PARAMETERS
 *  old_grade       [IN]        
 *  new_grade       [IN]        
 * RETURNS
 *  S16
 *****************************************************************************/
S16 mmi_gx_copter_calc_best_grade(S16 old_grade, S16 new_grade)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* compare the best grade and return it */
    if (new_grade > old_grade)
    {
        return new_grade;
    }
    else
    {
        return old_grade;
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_set_gameover
 * DESCRIPTION
 *  Set the gameover state
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_set_gameover(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_gx_copter_context.is_gameover == TRUE)
    {
        return;
    }

    g_gx_copter_context.is_gameover = TRUE;

    GFX_PLAY_VIBRATION();
#ifdef __MMI_GAME_MULTICHANNEL_SOUND__

    GFX_STOP_MULTICHANNEL_WAV(g_gx_copter_context.down_wav);
    GFX_STOP_MULTICHANNEL_WAV(g_gx_copter_context.flying_wav);

    GFX_PLAY_SOUND_EFFECTS_MIDI(g_gx_copter_context.crash_midi);

#else /* __MMI_GAME_MULTICHANNEL_SOUND__ */ /* /__MMI_GAME_MULTICHANNEL_SOUND__ */
    GFX_PLAY_AUDIO_MIDI(CopterCrash_midi, COPTERCRASH_MIDI, DEVICE_AUDIO_PLAY_ONCE);
#endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ /* /__MMI_GAME_MULTICHANNEL_SOUND__ */

    g_gx_copter_context.game_grade = g_gx_copter_context.tick / 5;
    g_gx_copter_context.tick = 0;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_draw_gameover
 * DESCRIPTION
 *  Draw Gameover Screen [Callback required by GFX]
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_draw_gameover(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    GFX_PLAY_AUDIO_GAMEOVER();

    /* call this function to draw standard gameover screen */
#ifndef __MMI_GAME_MULTI_LANGUAGE_SUPPORT__
    mmi_gfx_draw_gameover_screen(
        IMG_ID_GX_COPTER_GOTEXT,
        IMG_ID_GX_COPTER_GRADESMAP,
        IMG_ID_GX_COPTER_GOPIC,
        g_gx_copter_context.game_grade);
#else
    mmi_gfx_draw_gameover_screen(
        mmi_gfx_get_multilanguage_image_ID(
         mmi_copter_language_index, 
         IMG_ID_GX_COPTER_GOTEXT_LANGUAGE0, 
         MMI_COPTER_STRING_COUNT, 
         MMI_COPTER_STRING_GAMEOVER),
        IMG_ID_GX_COPTER_GRADESMAP,
        IMG_ID_GX_COPTER_GOPIC,
        g_gx_copter_context.game_grade);
#endif
}


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_enter_game
 * DESCRIPTION
 *  Enter Game [Callback required by GFX]
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_enter_game(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __MMI_GAME_MULTI_LANGUAGE_SUPPORT__  //used for multilanguage
    mmi_copter_language_index = g_mmi_game_current_language_index;
    mmi_gfx_check_image_get_valid_language(
        &mmi_copter_language_index, 
        IMG_ID_GX_COPTER_GOTEXT_LANGUAGE0, 
        MMI_COPTER_STRING_COUNT);
#endif  /* __MMI_GAME_MULTI_LANGUAGE_SUPPORT__ */
    if (g_gx_copter_context.is_new_game == TRUE)
    {
        mmi_gx_copter_init_game();  /* is new game, otherwise resume game */
    }

#if defined(GDI_USING_LAYER)
    gdi_layer_multi_layer_enable();
    gdi_layer_get_base_handle(&g_gx_copter_context.background);
/*
    gdi_layer_create(0, 0, MMI_GX_COPTER_LCD_WIDTH, MMI_GX_COPTER_LCD_HEIGHT, &g_gx_copter_context.foreground);
    gdi_layer_set_active(g_gx_copter_context.foreground);
    gdi_layer_set_source_key(TRUE, MMI_GX_COPTER_TRANSPARENT_COLOR);
    gdi_layer_clear_background(MMI_GX_COPTER_TRANSPARENT_COLOR);
*/
    gdi_layer_set_active(g_gx_copter_context.background);
    gdi_layer_set_source_key(TRUE, MMI_GX_COPTER_TRANSPARENT_COLOR);
    gdi_layer_clear_background(MMI_GX_COPTER_TRANSPARENT_COLOR);

#endif /* defined(GDI_USING_LAYER) */ 

    /* clear key state */
    g_gx_copter_context.key_pressed = FALSE;

    if (g_gx_copter_context.is_gameover != TRUE)
    {
        g_gx_copter_context.is_new_game = FALSE;
        g_gx_copter_context.is_gameover = FALSE;

        SetKeyHandler(mmi_gx_copter_key_pressed, KEY_5, KEY_EVENT_DOWN);
        SetKeyHandler(mmi_gx_copter_key_released, KEY_5, KEY_EVENT_UP);
    }

    gdi_layer_lock_frame_buffer();
    mmi_gx_copter_draw_static_background();
    mmi_gx_copter_draw_background();     
    /* render first frame */
    mmi_gx_copter_render();
    gdi_layer_unlock_frame_buffer();

#ifdef __MMI_GAME_MULTICHANNEL_SOUND__
    GFX_OPEN_BACKGROUND_SOUND(Copter_background_midi, COPTERBACKGROUND_MIDI, g_gx_copter_context.background_midi);
    GFX_PLAY_BACKGROUND_SOUND(g_gx_copter_context.background_midi);

    GFX_OPEN_DUMMY_BACKGROUND_SOUND();
    GFX_PLAY_DUMMY_BACKGROUND_SOUND();
    GFX_OPEN_SOUND_EFFECTS_MIDI(CopterCrash_midi, COPTERCRASH_MIDI, 1, g_gx_copter_context.crash_midi);

    GFX_OPEN_MULTICHANNEL_WAV(CopterDown_wav, COPTERDOWN_WAV, 0, g_gx_copter_context.down_wav);
    GFX_OPEN_MULTICHANNEL_WAV(CopterFlying_wav, COPTERFLYING_WAV, 0, g_gx_copter_context.flying_wav);

    GFX_STOP_MULTICHANNEL_WAV(g_gx_copter_context.down_wav);
    GFX_STOP_MULTICHANNEL_WAV(g_gx_copter_context.flying_wav);
    if (g_gx_copter_context.is_gameover != TRUE)
    {
        GFX_PLAY_MULTICHANNEL_WAV(g_gx_copter_context.down_wav);
    }
#else /* __MMI_GAME_MULTICHANNEL_SOUND__ */ /* /__MMI_GAME_MULTICHANNEL_SOUND__ */
    if (g_gx_copter_context.is_gameover != TRUE)
    {
        GFX_PLAY_AUDIO_DVI(CopterDown_dvi, COPTERDOWN_DVI, DEVICE_AUDIO_PLAY_INFINITE);
    }
#endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 

    //  /* set bgm resume handle */
    //      SetProtocolEventHandler(mmi_gx_copter_resume_bgm, PRT_EQ_PLAY_AUDIO_FINISH_IND);

    /* start game loop */
    mmi_gx_copter_cyclic_timer();

#ifdef __MMI_TOUCH_SCREEN__
    wgui_register_pen_down_handler(mmi_copter_pen_down_hdlr);
    wgui_register_pen_up_handler(mmi_copter_pen_up_hdlr);
    wgui_register_pen_repeat_handler(mmi_copter_pen_repeat_hdlr);
#endif /* __MMI_TOUCH_SCREEN__ */ 
}

#if defined(GDI_USING_LAYER)


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_init_background_list
 * DESCRIPTION
 *  init the background list
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_init_background_list(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 i;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_gx_copter_context.bg_image_list[0].image_id = (MMI_ID_TYPE) IMG_ID_GX_COPTER_BACKGROUND;
    g_gx_copter_context.first_bg_image = &g_gx_copter_context.bg_image_list[0];

    for (i = 0; i < MMI_GX_COPTER_BG_LIST_NUMBER - 1; i++)
    {
        g_gx_copter_context.bg_image_list[i].next = &g_gx_copter_context.bg_image_list[i + 1];
        g_gx_copter_context.bg_image_list[i + 1].image_id = (MMI_ID_TYPE) IMG_ID_GX_COPTER_BACKGROUND;
    }

    g_gx_copter_context.last_bg_image = &g_gx_copter_context.bg_image_list[MMI_GX_COPTER_BG_LIST_NUMBER - 1];
}


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_draw_background
 * DESCRIPTION
 *  draw the moving background
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_draw_background(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 offset_x = 0;
    S32 offset_y = MMI_GX_COPTER_GAME_ORIGIN;
    S32 buf_size;
	U8 i;
    gx_copter_obstacle_node_struct *tmp_node;
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    
    gui_measure_image(get_image(IMG_ID_GX_COPTER_BACKGROUND), &g_gx_copter_context.bg_image_width, &g_gx_copter_context.bg_image_height);

    buf_size = g_gx_copter_context.bg_image_width * g_gx_copter_context.bg_image_height * 2 * MMI_GX_COPTER_BG_LIST_NUMBER;
    g_gx_copter_context.dynamic_bg_layer_buf_ptr = mmi_frm_scrmem_alloc_framebuffer(buf_size);

    gdi_layer_create_using_outside_memory(
        0, 
        MMI_GX_COPTER_GAME_ORIGIN,
        g_gx_copter_context.bg_image_width * MMI_GX_COPTER_BG_LIST_NUMBER,
        g_gx_copter_context.bg_image_height,
        &g_gx_copter_context.dynamic_background,
        (PU8)g_gx_copter_context.dynamic_bg_layer_buf_ptr,
        buf_size);

    gdi_layer_set_active(g_gx_copter_context.dynamic_background);
    gdi_layer_set_source_key(TRUE, MMI_GX_COPTER_TRANSPARENT_COLOR);
    gdi_layer_clear_background(MMI_GX_COPTER_TRANSPARENT_COLOR);

    for (i = 0; i < MMI_GX_COPTER_BG_LIST_NUMBER; i++)
    {
        gdi_image_draw_id(offset_x, 0, (U16) g_gx_copter_context.bg_image_list[i].image_id);
        offset_x = offset_x + g_gx_copter_context.bg_image_width - 1;   //image width 57, use 56 for obstacle width is 8
    }
    
}
#endif /* defined(GDI_USING_LAYER) */ 


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_exit_game
 * DESCRIPTION
 *  Exit Game [Callback required by GFX]
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_exit_game(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_cancel_timer(mmi_gx_copter_cyclic_timer);   /* cancle the looping timer */
    mmi_frm_scrmem_free((void*)g_gx_copter_context.dynamic_bg_layer_buf_ptr);

#ifdef __MMI_GAME_MULTICHANNEL_SOUND__

    GFX_STOP_MULTICHANNEL_WAV(g_gx_copter_context.flying_wav);
    GFX_CLOSE_MULTICHANNEL_WAV(g_gx_copter_context.flying_wav);

    GFX_STOP_MULTICHANNEL_WAV(g_gx_copter_context.down_wav);
    GFX_CLOSE_MULTICHANNEL_WAV(g_gx_copter_context.down_wav);

    GFX_STOP_SOUND_EFFECTS_MIDI(g_gx_copter_context.crash_midi);
    GFX_CLOSE_SOUND_EFFECTS_MIDI(g_gx_copter_context.crash_midi);

    GFX_STOP_DUMMY_BACKGROUND_SOUND();
    GFX_CLOSE_DUMMY_BACKGROUND_SOUND();

    GFX_STOP_BACKGROUND_SOUND(g_gx_copter_context.background_midi);
    GFX_CLOSE_BACKGROUND_SOUND(g_gx_copter_context.background_midi);

#endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ /* /__MMI_GAME_MULTICHANNEL_SOUND__ */

#if defined(GDI_USING_LAYER)
    gdi_layer_free(g_gx_copter_context.dynamic_background);
    gdi_layer_multi_layer_disable();
#endif /* defined(GDI_USING_LAYER) */ 
}


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_init_game
 * DESCRIPTION
 *  Game initilization
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_init_game(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* init game */
    mmi_gx_copter_init_obstacle_list();

    g_gx_copter_context.local_step = 1;
    g_gx_copter_context.tick = 0;
    g_gx_copter_context.last_sound_playing_tick = 0;
    g_gx_copter_context.key_pressed = FALSE;
    g_gx_copter_context.is_gameover = FALSE;
    g_gx_copter_context.slope = 0;
    g_gx_copter_context.obstacle_period = 0;
    g_gx_copter_context.max_period = 0;
#if defined(__MMI_MAINLCD_128X160__)
    g_gx_copter_context.copter_position_y = 70;
    g_gx_copter_context.space = 120;
#elif defined(__MMI_MAINLCD_128X128__)
    g_gx_copter_context.copter_position_y = 70;
    g_gx_copter_context.space = 116;
#elif defined(__MMI_MAINLCD_176X220__)
    g_gx_copter_context.copter_position_y = 110;
    g_gx_copter_context.space = 162;
#endif 

#if defined(GDI_USING_LAYER)
    mmi_gx_copter_init_background_list();
    g_gx_copter_context.first_bg_position_x = 0;
#endif /* defined(GDI_USING_LAYER) */ 
}


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_init_obstacle_list
 * DESCRIPTION
 *  Initialize the obstacles
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_init_obstacle_list(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 i;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_gx_copter_context.obstacle[0].position_x = 0;
#if defined(__MMI_MAINLCD_128X128__)
    g_gx_copter_context.obstacle[0].position_y = 1;
#else
    g_gx_copter_context.obstacle[0].position_y = 0 + MMI_GX_COPTER_GAME_ORIGIN / 2;
#endif 

    g_gx_copter_context.obstacle[0].old_position_x = g_gx_copter_context.obstacle[0].position_x;
    g_gx_copter_context.obstacle[0].old_position_y = g_gx_copter_context.obstacle[0].position_y;

    /* Use single linking list structure for obstacles */
    for (i = 1; i < MMI_GX_COPTER_OBSTACLE_COUNT; i++)
    {
        g_gx_copter_context.obstacle[i].position_x =
            g_gx_copter_context.obstacle[i - 1].position_x + MMI_GX_COPTER_OBSTACLE_WIDTH;
    #if defined(__MMI_MAINLCD_128X128__)
        g_gx_copter_context.obstacle[i].position_y = g_gx_copter_context.obstacle[0].position_y;
    #else
        g_gx_copter_context.obstacle[i].position_y = 0 + MMI_GX_COPTER_GAME_ORIGIN / 2;
    #endif 
        g_gx_copter_context.obstacle[i - 1].next = &(g_gx_copter_context.obstacle[i]);
        g_gx_copter_context.obstacle[i].old_position_x = g_gx_copter_context.obstacle[i].position_x;
        g_gx_copter_context.obstacle[i].old_position_y = g_gx_copter_context.obstacle[i].position_y;
    }

    g_gx_copter_context.first_obstacle = &(g_gx_copter_context.obstacle[0]);
    g_gx_copter_context.last_obstacle = &(g_gx_copter_context.obstacle[MMI_GX_COPTER_OBSTACLE_COUNT - 1]);

    g_gx_copter_context.single_obstacle.position_x = (S16) MMI_GX_COPTER_LCD_WIDTH;
    g_gx_copter_context.single_obstacle.position_y =
        (2 * MMI_GX_COPTER_GAME_ORIGIN + MMI_GX_COPTER_GAME_HEIGHT) / 2 - MMI_GX_COPTER_OBSTACLE_HEIGHT / 2;
    g_gx_copter_context.single_obstacle.old_position_x = g_gx_copter_context.single_obstacle.position_x;
    g_gx_copter_context.single_obstacle.old_position_y = g_gx_copter_context.single_obstacle.position_y;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_draw_static_background
 * DESCRIPTION
 *  Draw the elements that only need to be drawn once
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_draw_static_background(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    gx_copter_obstacle_node_struct *tmp_node;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    
#if !defined(GDI_USING_LAYER)
    gui_fill_rectangle(0, 0, MMI_GX_COPTER_LCD_WIDTH - 1, MMI_GX_COPTER_LCD_HEIGHT - 1, MMI_GX_COPTER_BACK_COLOR);
#endif 

    gui_fill_rectangle(0, 0, MMI_GX_COPTER_LCD_WIDTH - 1, MMI_GX_COPTER_GAME_ORIGIN, MMI_GX_COPTER_BORDER_COLOR);

#if defined(__MMI_MAINLCD_128X160__) || defined(__MMI_MAINLCD_176X220__)
    gui_fill_rectangle(
        0,
        MMI_GX_COPTER_GAME_ORIGIN + MMI_GX_COPTER_GAME_HEIGHT + 1,
        MMI_GX_COPTER_LCD_WIDTH - 1,
        MMI_GX_COPTER_LCD_HEIGHT - 1,
        MMI_GX_COPTER_BORDER_COLOR);
#endif /* defined(__MMI_GAME_COPTER_128x160__) || defined(__MMI_GAME_COPTER_176x220__) || defined(__MMI_GAME_SUBMARINE_128x160__) || defined(__MMI_GAME_SUBMARINE_176x220__) || defined(__MMI_GAME_JET_128x160__) || defined(__MMI_GAME_JET_176x220__) */ 

#if defined(__MMI_MAINLCD_128X160__) || defined(__MMI_MAINLCD_176X220__)
    /* top four lines here */
    gui_draw_horizontal_line(2, MMI_GX_COPTER_LCD_WIDTH - 1 - 2, 1, MMI_GX_COPTER_LIGHT_BORDER);
    gui_draw_horizontal_line(
        2,
        MMI_GX_COPTER_LCD_WIDTH - 1 - 2,
        MMI_GX_COPTER_GAME_ORIGIN - 2,
        MMI_GX_COPTER_DARK_BORDER);
    gui_draw_vertical_line(2, MMI_GX_COPTER_GAME_ORIGIN - 3, 1, MMI_GX_COPTER_LIGHT_BORDER);
    gui_draw_vertical_line(
        2,
        MMI_GX_COPTER_GAME_ORIGIN - 3,
        MMI_GX_COPTER_LCD_WIDTH - 1 - 1,
        MMI_GX_COPTER_DARK_BORDER);

    /* bottom four lines here */
    gui_draw_horizontal_line(
        2,
        MMI_GX_COPTER_LCD_WIDTH - 1 - 2,
        MMI_GX_COPTER_GAME_ORIGIN + MMI_GX_COPTER_GAME_HEIGHT + 1,
        MMI_GX_COPTER_LIGHT_BORDER);
    gui_draw_horizontal_line(
        2,
        MMI_GX_COPTER_LCD_WIDTH - 1 - 2,
        MMI_GX_COPTER_LCD_HEIGHT - 1 - 1,
        MMI_GX_COPTER_DARK_BORDER);
    gui_draw_vertical_line(
        MMI_GX_COPTER_GAME_ORIGIN + MMI_GX_COPTER_GAME_HEIGHT + 2,
        MMI_GX_COPTER_LCD_HEIGHT - 1 - 2,
        1,
        MMI_GX_COPTER_LIGHT_BORDER);
    gui_draw_vertical_line(
        MMI_GX_COPTER_GAME_ORIGIN + MMI_GX_COPTER_GAME_HEIGHT + 2,
        MMI_GX_COPTER_LCD_HEIGHT - 1 - 2,
        MMI_GX_COPTER_LCD_WIDTH - 1 - 1,
        MMI_GX_COPTER_DARK_BORDER);

#elif defined(__MMI_MAINLCD_128X128__)
    //      gui_fill_rectangle(     0,
    //                                                                              MMI_GX_COPTER_LCD_HEIGHT - 1,
    //                                                                              MMI_GX_COPTER_LCD_WIDTH - 1,
    //                                                                              MMI_GX_COPTER_LCD_HEIGHT - 1,
    //                                                                              gui_color(255, 127, 0));
#endif 

#ifndef __MMI_GAME_MULTI_LANGUAGE_SUPPORT__
#if defined(__MMI_MAINLCD_128X160__) || defined(__MMI_MAINLCD_176X220__)
    gui_show_image(
        MMI_GX_COPTER_SCORE_POSITION_X + 2,
        MMI_GX_COPTER_SCORE_POSITION_Y - 1,
        (PU8) GetImage(IMG_ID_GX_COPTER_SCORE));
#elif defined(__MMI_MAINLCD_128X128__)
    gui_show_image(
        MMI_GX_COPTER_SCORE_POSITION_X + 1,
        MMI_GX_COPTER_SCORE_POSITION_Y - 2,
        (PU8) GetImage(IMG_ID_GX_COPTER_SCORE));
#endif 
#endif

#if defined(__MMI_MAINLCD_128X160__) || defined(__MMI_MAINLCD_176X220__)
    gui_show_image(MMI_GX_COPTER_SCORE_POSITION_X,
#if defined(__MMI_MAINLCD_128X160__)
                   MMI_GX_COPTER_SCORE_POSITION_Y + 7,
#elif defined(__MMI_MAINLCD_176X220__)
                   MMI_GX_COPTER_SCORE_POSITION_Y + 10,
#endif 
                   (PU8) GetImage(IMG_ID_GX_COPTER_BOX));

    gui_show_image(MMI_GX_COPTER_TITLE_POSITION_X, 1, (PU8) GetImage(IMG_ID_GX_COPTER_TITLE));
#elif defined(__MMI_MAINLCD_128X128__)
    gui_show_image(
        MMI_GX_COPTER_SCORE_POSITION_X + 29,
        MMI_GX_COPTER_SCORE_POSITION_Y - 4,
        (PU8) GetImage(IMG_ID_GX_COPTER_BOX));
#endif 
    if (g_gx_copter_context.is_gameover != FALSE)
    {
        gui_push_clip();
        /* draw ceiling and floor obstacles */
        gui_set_clip(
            0,
            MMI_GX_COPTER_GAME_ORIGIN,
            MMI_GX_COPTER_LCD_WIDTH - 1,
            MMI_GX_COPTER_GAME_ORIGIN + MMI_GX_COPTER_GAME_HEIGHT - 1);

    #if defined(GDI_USING_LAYER)
        ERASE_AND_DRAW_OBSTACLES(tmp_node, gdi_draw_solid_rect, MMI_GX_COPTER_TRANSPARENT_COLOR);
    #else 
        ERASE_AND_DRAW_OBSTACLES(tmp_node, gui_fill_rectangle, MMI_GX_COPTER_BACK_COLOR);
    #endif 

        /* draw single obstacle */
        gui_fill_rectangle(
            g_gx_copter_context.single_obstacle.old_position_x,
            g_gx_copter_context.single_obstacle.old_position_y,
            g_gx_copter_context.single_obstacle.old_position_x + MMI_GX_COPTER_OBSTACLE_WIDTH - 1,
            g_gx_copter_context.single_obstacle.old_position_y + MMI_GX_COPTER_OBSTACLE_HEIGHT - 1,
            MMI_GX_COPTER_BACK_COLOR);

        gui_show_image(
            g_gx_copter_context.single_obstacle.position_x,
            g_gx_copter_context.single_obstacle.position_y,
            (PU8) GetImage(IMG_ID_GX_COPTER_OBSTACLE));
        gui_pop_clip();
    }

#if !defined(GDI_USING_LAYER)
    gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
#endif 

}


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_framemove
 * DESCRIPTION
 *  Framemove - process the game logic
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_framemove(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 i;
    gx_copter_obstacle_node_struct *tmp_node;
    U8 probability;
    S16 obstacle_shift;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#if defined(GDI_USING_LAYER)
    /* update the background */
    g_gx_copter_context.first_bg_position_x = g_gx_copter_context.first_bg_position_x - MMI_GX_COPTER_OBSTACLE_SPEED;
    if(g_gx_copter_context.first_bg_position_x <= -g_gx_copter_context.bg_image_width + 1)
    {
        g_gx_copter_context.first_bg_position_x += g_gx_copter_context.bg_image_width - 1;
    }
#endif /* defined(GDI_USING_LAYER) */ 

    gdi_layer_set_active(g_gx_copter_context.dynamic_background);
    gdi_layer_set_position(g_gx_copter_context.first_bg_position_x, MMI_GX_COPTER_GAME_ORIGIN);
    gdi_layer_set_active(g_gx_copter_context.background);
    
/* update the position of the copter */
    g_gx_copter_context.copter_position_old_y = g_gx_copter_context.copter_position_y;
    if (g_gx_copter_context.key_pressed != FALSE)
    {
        g_gx_copter_context.copter_position_y = g_gx_copter_context.copter_position_y - g_gx_copter_context.local_step;
    }
    else
    {
        g_gx_copter_context.copter_position_y = g_gx_copter_context.copter_position_y + g_gx_copter_context.local_step;
    }

    /* if the acceleration of falling speed is less than 4 (or 6), then increase the acceleration */
#if defined(__MMI_MAINLCD_176X220__)
    if (g_gx_copter_context.local_step < 6)
#else
    if (g_gx_copter_context.local_step < 4)
#endif 
    {
        g_gx_copter_context.local_step = g_gx_copter_context.local_step + 1;
    }

    /* update information of floor and ceiling obstacles */
    tmp_node = g_gx_copter_context.first_obstacle;
    while (1)
    {
        tmp_node->old_position_x = tmp_node->position_x;
        tmp_node->old_position_y = tmp_node->position_y;
        tmp_node->position_x = tmp_node->position_x - MMI_GX_COPTER_OBSTACLE_SPEED;
        if (tmp_node == g_gx_copter_context.last_obstacle)
        {
            break;
        }
        tmp_node = tmp_node->next;
    }

    /* if the first obstacle is going out of the boundary, move it to the last of the obstacle list */
    if (g_gx_copter_context.first_obstacle->position_x < -MMI_GX_COPTER_OBSTACLE_WIDTH)
    {
        g_gx_copter_context.first_obstacle->position_x =
            g_gx_copter_context.last_obstacle->position_x + MMI_GX_COPTER_OBSTACLE_WIDTH;

        /* if the duration of the slope of obstacles expire, determine its new duration time and slope */
        if (g_gx_copter_context.obstacle_period > g_gx_copter_context.max_period)
        {
            g_gx_copter_context.obstacle_period = 0;
            probability = rand() % 10;
            g_gx_copter_context.max_period = rand() % 10;
            if (probability < 5)
            {
                g_gx_copter_context.slope = 1;
            }
            else if (probability > 7)
            {
                g_gx_copter_context.slope = 3;
            }
            else
            {
                g_gx_copter_context.slope = 2;
            }

            if (probability % 2 == 0)
            {
                g_gx_copter_context.slope = -g_gx_copter_context.slope;
            }
        }
        else
        {
            g_gx_copter_context.obstacle_period = g_gx_copter_context.obstacle_period + 1;
        }

        g_gx_copter_context.first_obstacle->old_position_y = g_gx_copter_context.first_obstacle->position_y;
        g_gx_copter_context.first_obstacle->position_y =
            g_gx_copter_context.last_obstacle->position_y + g_gx_copter_context.slope;

        /* To get the proper space between floor and ceiling obstalcles */
    #if defined(__MMI_MAINLCD_128X160__)
        while (g_gx_copter_context.first_obstacle->position_y > MMI_GX_COPTER_GAME_ORIGIN ||
               g_gx_copter_context.first_obstacle->position_y < MMI_GX_COPTER_GAME_ORIGIN / 2 - 8)
    #elif defined(__MMI_MAINLCD_128X128__)
        while (g_gx_copter_context.first_obstacle->position_y > MMI_GX_COPTER_GAME_ORIGIN - 2 ||
               g_gx_copter_context.first_obstacle->position_y < -7)
    #elif defined(__MMI_MAINLCD_176X220__)
        while (g_gx_copter_context.first_obstacle->position_y > MMI_GX_COPTER_GAME_ORIGIN ||
               g_gx_copter_context.first_obstacle->position_y < MMI_GX_COPTER_GAME_ORIGIN / 2 - 11)
    #endif 
        {
            g_gx_copter_context.slope = -g_gx_copter_context.slope;
            g_gx_copter_context.first_obstacle->position_y =
                g_gx_copter_context.last_obstacle->position_y + g_gx_copter_context.slope;
        }

        g_gx_copter_context.last_obstacle->next = g_gx_copter_context.first_obstacle;
        g_gx_copter_context.last_obstacle = g_gx_copter_context.first_obstacle;
        g_gx_copter_context.first_obstacle = g_gx_copter_context.first_obstacle->next;
    }

    /* update information of single obstacle */
    g_gx_copter_context.single_obstacle.old_position_x = g_gx_copter_context.single_obstacle.position_x;
    g_gx_copter_context.single_obstacle.position_x =
        g_gx_copter_context.single_obstacle.position_x - MMI_GX_COPTER_OBSTACLE_SPEED;

    probability = rand() % 10;
    if (probability % 2 == 0)
    {
        obstacle_shift = rand() % 20;
    }
    else
    {
        obstacle_shift = -(rand() % 20);
    }

    /* if the obstacle is going out of the boundary, set it as a new obstacle */
    if (g_gx_copter_context.single_obstacle.position_x < -MMI_GX_COPTER_OBSTACLE_WIDTH - 2)
    {
        g_gx_copter_context.single_obstacle.position_x = (S16) MMI_GX_COPTER_LCD_WIDTH;
        g_gx_copter_context.single_obstacle.position_y =
            g_gx_copter_context.last_obstacle->position_y + MMI_GX_COPTER_OBSTACLE_HEIGHT +
            MMI_GX_COPTER_COPTER_HEIGHT * 3 + obstacle_shift;
        g_gx_copter_context.single_obstacle.old_position_y = g_gx_copter_context.single_obstacle.position_y;
    }

    /* collision detection */
    /* case for the single obstacle */
    if (g_gx_copter_context.single_obstacle.position_x < MMI_GX_COPTER_COPTER_X + MMI_GX_COPTER_COPTER_WIDTH)
    {
        if (g_gx_copter_context.copter_position_y + MMI_GX_COPTER_COPTER_HEIGHT - 1 >=
            g_gx_copter_context.single_obstacle.position_y &&
            g_gx_copter_context.copter_position_y <=
            g_gx_copter_context.single_obstacle.position_y + MMI_GX_COPTER_OBSTACLE_HEIGHT - 1 &&
            g_gx_copter_context.single_obstacle.position_x + MMI_GX_COPTER_OBSTACLE_WIDTH - 1 >= MMI_GX_COPTER_COPTER_X)
        {
            mmi_gx_copter_set_gameover();
        }
    }

    /* case for the upper obstacles */
#if defined(__MMI_MAINLCD_128X160__)
    if (g_gx_copter_context.copter_position_y < 87)
#elif defined(__MMI_MAINLCD_128X128__)
    if (g_gx_copter_context.copter_position_y < 73)
#elif defined(__MMI_MAINLCD_176X220__)
    if (g_gx_copter_context.copter_position_y < 120)
#endif 
    {
        tmp_node = g_gx_copter_context.first_obstacle->next;

        /* due to the fixed position of copter, only need to check the first 2~6th obstacles */
        for (i = 0; i < 5; i++)
        {
            if ((g_gx_copter_context.copter_position_y <= tmp_node->position_y + MMI_GX_COPTER_OBSTACLE_HEIGHT - 1 ||
                 g_gx_copter_context.copter_position_y <= MMI_GX_COPTER_GAME_ORIGIN) &&
                tmp_node->position_x + MMI_GX_COPTER_OBSTACLE_WIDTH - 1 >= MMI_GX_COPTER_COPTER_X &&
                MMI_GX_COPTER_COPTER_X + MMI_GX_COPTER_COPTER_WIDTH - 1 >= tmp_node->position_x)
            {
                mmi_gx_copter_set_gameover();
            }
            tmp_node = tmp_node->next;
        }
    }

    /* case for the lower obstacles */
#if defined(__MMI_MAINLCD_128X160__)
    if (g_gx_copter_context.copter_position_y >= 87)
#elif defined(__MMI_MAINLCD_128X128__)
    if (g_gx_copter_context.copter_position_y >= 73)
#elif defined(__MMI_MAINLCD_176X220__)
    if (g_gx_copter_context.copter_position_y >= 120)
#endif 
    {
        tmp_node = g_gx_copter_context.first_obstacle->next;

        /* due to the fixed position of copter, only need to check the first 2~6th obstacles */
        for (i = 0; i < 5; i++)
        {
            if ((g_gx_copter_context.copter_position_y + MMI_GX_COPTER_COPTER_HEIGHT - 1 >=
                 tmp_node->position_y + g_gx_copter_context.space ||
        #if defined(__MMI_MAINLCD_128X128__)
                 g_gx_copter_context.copter_position_y + MMI_GX_COPTER_COPTER_HEIGHT - 1 >=
                 MMI_GX_COPTER_GAME_ORIGIN + MMI_GX_COPTER_GAME_HEIGHT) &&
        #else
                 g_gx_copter_context.copter_position_y + MMI_GX_COPTER_COPTER_HEIGHT - 1 >=
                 MMI_GX_COPTER_GAME_ORIGIN + MMI_GX_COPTER_GAME_HEIGHT) &&
        #endif 
                tmp_node->position_x + MMI_GX_COPTER_OBSTACLE_WIDTH - 1 >= MMI_GX_COPTER_COPTER_X &&
                MMI_GX_COPTER_COPTER_X + MMI_GX_COPTER_COPTER_WIDTH - 1 >= tmp_node->position_x)
            {
                if (g_gx_copter_context.is_gameover != TRUE)
                {
                    mmi_gx_copter_set_gameover();
                }
            }
            tmp_node = tmp_node->next;
        }
    }

    /* decrease the space between ceiling and floor one pixel for every 20 secs for the first 10 minutes */
    if (g_gx_copter_context.is_gameover != TRUE && g_gx_copter_context.tick % 200 == 0 &&
        g_gx_copter_context.tick < 6001)
    {
    #if defined(__MMI_MAINLCD_176X220__)
        g_gx_copter_context.space = g_gx_copter_context.space - 2;
    #else
        g_gx_copter_context.space = g_gx_copter_context.space - 1;
    #endif 
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_render
 * DESCRIPTION
 *  Render the game images
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_render(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    /* add drawing code here */

    MMI_ID_TYPE image_id;   /* store the last digit of tick */
    S16 position_shift;     /* the position offset of digit displayed */
    S32 tmp_tick;
    gx_copter_obstacle_node_struct *tmp_node;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_gx_copter_context.is_gameover == TRUE)
    {
        return;
    }

#if defined(GDI_USING_LAYER)
    gdi_layer_set_active(g_gx_copter_context.background);
    gdi_layer_push_clip();
#endif /* defined(GDI_USING_LAYER) */ 

    tmp_tick = g_gx_copter_context.tick / 5;
    position_shift = MMI_GX_COPTER_SCORE_POSITION_X - 2;

    /* make grade same as drawing */
    g_gx_copter_context.game_grade = tmp_tick;

    do
    {
        image_id = IMG_ID_GX_COPTER_NUMBER_0 + (tmp_tick % 10);
        tmp_tick = tmp_tick / 10;
    #if defined(__MMI_MAINLCD_128X160__)
        gui_show_image(
            MMI_GX_COPTER_SCORE_POSITION_X + 15 + position_shift,
            MMI_GX_COPTER_SCORE_POSITION_Y + 9,
            (PU8) GetImage(image_id));
    #elif defined(__MMI_MAINLCD_128X128__)
        gui_show_image(
            MMI_GX_COPTER_SCORE_POSITION_X + 20 + position_shift,
            MMI_GX_COPTER_SCORE_POSITION_Y - 2,
            (PU8) GetImage(image_id));
    #elif defined(__MMI_MAINLCD_176X220__) 
        gui_show_image(
            MMI_GX_COPTER_SCORE_POSITION_X + 18 + position_shift,
            MMI_GX_COPTER_SCORE_POSITION_Y + 12,
            (PU8) GetImage(image_id));
    #endif 

    #if defined(__MMI_MAINLCD_176X220__)
        position_shift = position_shift - MMI_GX_COPTER_DIGIT_WIDTH - 1;
    #else 
        position_shift = position_shift - MMI_GX_COPTER_DIGIT_WIDTH;
    #endif 

    } while (tmp_tick != 0);

    gui_set_clip(
        0,
        MMI_GX_COPTER_GAME_ORIGIN,
        MMI_GX_COPTER_LCD_WIDTH - 1,
        MMI_GX_COPTER_GAME_ORIGIN + MMI_GX_COPTER_GAME_HEIGHT - 1);

#if defined(GDI_USING_LAYER)
    gdi_draw_solid_rect(
        MMI_GX_COPTER_COPTER_X,
        g_gx_copter_context.copter_position_old_y,
        MMI_GX_COPTER_COPTER_X + MMI_GX_COPTER_COPTER_WIDTH - 1,
        g_gx_copter_context.copter_position_old_y + MMI_GX_COPTER_COPTER_HEIGHT - 1,
        MMI_GX_COPTER_TRANSPARENT_COLOR);
#else /* defined(GDI_USING_LAYER) */ 
    gui_fill_rectangle(
        MMI_GX_COPTER_COPTER_X,
        g_gx_copter_context.copter_position_old_y,
        MMI_GX_COPTER_COPTER_X + MMI_GX_COPTER_COPTER_WIDTH - 1,
        g_gx_copter_context.copter_position_old_y + MMI_GX_COPTER_COPTER_HEIGHT - 1,
        MMI_GX_COPTER_BACK_COLOR);
#endif /* defined(GDI_USING_LAYER) */ 

    /* erase the previous single obstacle */
#if defined(GDI_USING_LAYER)
    gdi_draw_solid_rect(
        g_gx_copter_context.single_obstacle.old_position_x,
        g_gx_copter_context.single_obstacle.old_position_y,
        g_gx_copter_context.single_obstacle.old_position_x + MMI_GX_COPTER_OBSTACLE_WIDTH - 1,
        g_gx_copter_context.single_obstacle.old_position_y + MMI_GX_COPTER_OBSTACLE_HEIGHT - 1,
        MMI_GX_COPTER_TRANSPARENT_COLOR);
#else /* defined(GDI_USING_LAYER) */ 
    gui_fill_rectangle(
        g_gx_copter_context.single_obstacle.old_position_x,
        g_gx_copter_context.single_obstacle.old_position_y,
        g_gx_copter_context.single_obstacle.old_position_x + MMI_GX_COPTER_OBSTACLE_WIDTH - 1,
        g_gx_copter_context.single_obstacle.old_position_y + MMI_GX_COPTER_OBSTACLE_HEIGHT - 1,
        MMI_GX_COPTER_BACK_COLOR);
#endif /* defined(GDI_USING_LAYER) */ 

    /* erase ceiling and floor obstacles */
#if defined(GDI_USING_LAYER)
    ERASE_AND_DRAW_OBSTACLES(tmp_node, gdi_draw_solid_rect, MMI_GX_COPTER_TRANSPARENT_COLOR);
#else 
    ERASE_AND_DRAW_OBSTACLES(tmp_node, gui_fill_rectangle, MMI_GX_COPTER_BACK_COLOR);
#endif 

    /* draw single obstacle */
    gui_show_image(
        g_gx_copter_context.single_obstacle.position_x,
        g_gx_copter_context.single_obstacle.position_y,
        (PU8) GetImage(IMG_ID_GX_COPTER_OBSTACLE));

    /* draw copter */
    image_id = (U16) (IMG_ID_GX_COPTER_0 + (g_gx_copter_context.tick % 3));
    gui_show_transparent_image(
        MMI_GX_COPTER_COPTER_X,
        g_gx_copter_context.copter_position_y,
        (PU8) GetImage(image_id),
        0);

    gui_set_clip(0, 0, MMI_GX_COPTER_LCD_WIDTH - 1, MMI_GX_COPTER_LCD_HEIGHT - 1);

#if defined(GDI_USING_LAYER)
    gdi_layer_blt(
        g_gx_copter_context.dynamic_background,
        g_gx_copter_context.background,
        0,
        0,
        0,
        0,
        MMI_GX_COPTER_LCD_WIDTH - 1,
        MMI_GX_COPTER_LCD_HEIGHT - 1);

    gdi_layer_pop_clip();
    gdi_layer_set_active(g_gx_copter_context.background);
#else /* defined(GDI_USING_LAYER) */ 
    gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
#endif /* defined(GDI_USING_LAYER) */ 
}


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_gameover
 * DESCRIPTION
 *  Gameover function
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_gameover(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_gx_copter_context.is_gameover = TRUE;
    g_gx_copter_context.is_new_game = TRUE;

    /* call this function to draw gameover screen */
    mmi_gfx_entry_gameover_screen();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_draw_crash
 * DESCRIPTION
 *  Draw crash images
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_draw_crash(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MMI_ID_TYPE image_id;
    gx_copter_obstacle_node_struct *tmp_node;
    S32 tmp_tick;
    S16 position_shift; /* the position offset of digit displayed */

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#if defined(GDI_USING_LAYER)
    gdi_layer_set_active(g_gx_copter_context.background);
    gdi_layer_push_clip();
#else /* defined(GDI_USING_LAYER) */ 
    gui_push_clip();
#endif /* defined(GDI_USING_LAYER) */ 

    tmp_tick = g_gx_copter_context.game_grade;
    position_shift = MMI_GX_COPTER_SCORE_POSITION_X - 2;
    do
    {
        image_id = IMG_ID_GX_COPTER_NUMBER_0 + (tmp_tick % 10);
        tmp_tick = tmp_tick / 10;
    #if defined(__MMI_MAINLCD_128X160__)
        gui_show_image(
            MMI_GX_COPTER_SCORE_POSITION_X + 15 + position_shift,
            MMI_GX_COPTER_SCORE_POSITION_Y + 9,
            (PU8) GetImage(image_id));
    #elif defined(__MMI_MAINLCD_128X128__)
        gui_show_image(
            MMI_GX_COPTER_SCORE_POSITION_X + 20 + position_shift,
            MMI_GX_COPTER_SCORE_POSITION_Y - 2,
            (PU8) GetImage(image_id));
    #elif defined(__MMI_MAINLCD_176X220__)
        gui_show_image(
            MMI_GX_COPTER_SCORE_POSITION_X + 18 + position_shift,
            MMI_GX_COPTER_SCORE_POSITION_Y + 12,
            (PU8) GetImage(image_id));
    #endif 

    #if defined(__MMI_MAINLCD_176X220__)
        position_shift = position_shift - MMI_GX_COPTER_DIGIT_WIDTH - 1;
    #else 
        position_shift = position_shift - MMI_GX_COPTER_DIGIT_WIDTH;
    #endif 

    } while (tmp_tick != 0);

    if (g_gx_copter_context.tick <= 8)
    {
        image_id = IMG_ID_GX_COPTER_CRASHED_0;
    }
    else if (g_gx_copter_context.tick <= 16)
    {
        image_id = IMG_ID_GX_COPTER_CRASHED_1;
    }
    else
    {
        image_id = IMG_ID_GX_COPTER_CRASHED_2;
    }

    gui_set_clip(
        0,
        MMI_GX_COPTER_GAME_ORIGIN,
        MMI_GX_COPTER_LCD_WIDTH - 1,
        MMI_GX_COPTER_GAME_ORIGIN + MMI_GX_COPTER_GAME_HEIGHT - 1);

    /* erase the previous image of the copter */
#if defined(GDI_USING_LAYER)
    gdi_draw_solid_rect(
        MMI_GX_COPTER_COPTER_X,
        g_gx_copter_context.copter_position_old_y,
        MMI_GX_COPTER_COPTER_X + MMI_GX_COPTER_COPTER_WIDTH - 1,
        g_gx_copter_context.copter_position_old_y + MMI_GX_COPTER_COPTER_HEIGHT - 1,
        MMI_GX_COPTER_TRANSPARENT_COLOR);
#else /* defined(GDI_USING_LAYER) */ 
    gui_fill_rectangle(
        MMI_GX_COPTER_COPTER_X,
        g_gx_copter_context.copter_position_old_y,
        MMI_GX_COPTER_COPTER_X + MMI_GX_COPTER_COPTER_WIDTH - 1,
        g_gx_copter_context.copter_position_old_y + MMI_GX_COPTER_COPTER_HEIGHT - 1,
        MMI_GX_COPTER_BACK_COLOR);
#endif /* defined(GDI_USING_LAYER) */ 

    /* erase and draw ceiling and floor obstacles */
#if defined(GDI_USING_LAYER)
    ERASE_AND_DRAW_OBSTACLES(tmp_node, gdi_draw_solid_rect, MMI_GX_COPTER_TRANSPARENT_COLOR);
#else 
    ERASE_AND_DRAW_OBSTACLES(tmp_node, gui_fill_rectangle, MMI_GX_COPTER_BACK_COLOR);
#endif 

    /* erase single obstacle */
#if defined(GDI_USING_LAYER)
    gdi_draw_solid_rect(
        g_gx_copter_context.single_obstacle.old_position_x,
        g_gx_copter_context.single_obstacle.old_position_y,
        g_gx_copter_context.single_obstacle.old_position_x + MMI_GX_COPTER_OBSTACLE_WIDTH - 1,
        g_gx_copter_context.single_obstacle.old_position_y + MMI_GX_COPTER_OBSTACLE_HEIGHT - 1,
        MMI_GX_COPTER_TRANSPARENT_COLOR);
#else /* defined(GDI_USING_LAYER) */ 
    gui_fill_rectangle(
        g_gx_copter_context.single_obstacle.old_position_x,
        g_gx_copter_context.single_obstacle.old_position_y,
        g_gx_copter_context.single_obstacle.old_position_x + MMI_GX_COPTER_OBSTACLE_WIDTH - 1,
        g_gx_copter_context.single_obstacle.old_position_y + MMI_GX_COPTER_OBSTACLE_HEIGHT - 1,
        MMI_GX_COPTER_BACK_COLOR);
#endif /* defined(GDI_USING_LAYER) */ 

    gui_show_image(
        g_gx_copter_context.single_obstacle.position_x,
        g_gx_copter_context.single_obstacle.position_y,
        (PU8) GetImage(IMG_ID_GX_COPTER_OBSTACLE));

    /* if the position of the dying copter is lower than the boundary of the game display, set it to the boundary position */
    if (g_gx_copter_context.copter_position_y + MMI_GX_COPTER_COPTER_HEIGHT >=
        MMI_GX_COPTER_GAME_ORIGIN + MMI_GX_COPTER_GAME_HEIGHT)
    {
        g_gx_copter_context.copter_position_y =
            MMI_GX_COPTER_GAME_ORIGIN + MMI_GX_COPTER_GAME_HEIGHT - MMI_GX_COPTER_COPTER_HEIGHT + 1;
    }

    gui_show_transparent_image(
        MMI_GX_COPTER_COPTER_X,
        g_gx_copter_context.copter_position_y,
        (PU8) GetImage(image_id),
        0);
#if defined(GDI_USING_LAYER)
    gdi_layer_blt(
        g_gx_copter_context.dynamic_background,
        g_gx_copter_context.background,
        0,
        0,
        0,
        0,
        MMI_GX_COPTER_LCD_WIDTH - 1,
        MMI_GX_COPTER_LCD_HEIGHT - 1);

    gdi_layer_pop_clip();
    gdi_layer_set_active(g_gx_copter_context.background);
#else /* defined(GDI_USING_LAYER) */ 
    gui_pop_clip();
    gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
#endif /* defined(GDI_USING_LAYER) */ 

    if (g_gx_copter_context.tick >= 24)
    {
        mmi_gx_copter_gameover();
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_cyclic_timer
 * DESCRIPTION
 *  Timer trigger function - looping
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_cyclic_timer(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* accumulation for time */
    g_gx_copter_context.tick++;

    gui_start_timer(g_gx_copter_context.timer_elapse, mmi_gx_copter_cyclic_timer);

    if (g_gx_copter_context.is_gameover == FALSE)
    {

    mmi_gx_copter_framemove();

    MMI_COPTER_GET_START_TIME("mmi_gx_copter_render - start time: %d, %d");
    mmi_gx_copter_render();
    MMI_COPTER_GET_STOP_TIME_AND_PRINT_TRACE("mmi_gx_copter_render - end time: %d, %d","mmi_gx_copter_render - need time: %d, %d");
    }
    else
    {
        /* draw crash images */
        mmi_gx_copter_draw_crash();
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_key_pressed
 * DESCRIPTION
 *  Key handling
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_key_pressed(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_gx_copter_context.key_pressed = TRUE;

    if (g_gx_copter_context.is_gameover != FALSE)
    {
        return;
    }

    /* prevent the queue of sound events from overflowing */
    /* at least 200ms between two successive playing */
    if (g_gx_copter_context.tick - g_gx_copter_context.last_sound_playing_tick >= 2)
    {

    #ifdef __MMI_GAME_MULTICHANNEL_SOUND__
        GFX_STOP_MULTICHANNEL_WAV(g_gx_copter_context.down_wav);
        GFX_PLAY_MULTICHANNEL_WAV(g_gx_copter_context.flying_wav);
    #else /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
        GFX_PLAY_AUDIO_DVI(CopterFlying_dvi, COPTERFLYING_DVI, DEVICE_AUDIO_PLAY_INFINITE);
    #endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 

        g_gx_copter_context.last_sound_playing_tick = g_gx_copter_context.tick;
    }

}


/*****************************************************************************
 * FUNCTION
 *  mmi_gx_copter_key_released
 * DESCRIPTION
 *  Key handling
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_gx_copter_key_released(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_gx_copter_context.key_pressed = FALSE;
    g_gx_copter_context.local_step = 0;

    if (g_gx_copter_context.is_gameover != FALSE)
    {
        return;
    }
#ifdef __MMI_GAME_MULTICHANNEL_SOUND__
    GFX_STOP_MULTICHANNEL_WAV(g_gx_copter_context.flying_wav);
    GFX_PLAY_MULTICHANNEL_WAV(g_gx_copter_context.down_wav);
#else /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 
    GFX_PLAY_AUDIO_DVI(CopterDown_dvi, COPTERDOWN_DVI, DEVICE_AUDIO_PLAY_INFINITE);
#endif /* __MMI_GAME_MULTICHANNEL_SOUND__ */ 

}

/* MTK Leo add */
#ifdef __MMI_TOUCH_SCREEN__


/*****************************************************************************
 * FUNCTION
 *  mmi_copter_pen_down_hdlr
 * DESCRIPTION
 *  
 * PARAMETERS
 *  pos     [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_copter_pen_down_hdlr(mmi_pen_point_struct pos)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_gx_copter_key_pressed();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_copter_pen_repeat_hdlr
 * DESCRIPTION
 *  
 * PARAMETERS
 *  pos     [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_copter_pen_repeat_hdlr(mmi_pen_point_struct pos)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_gx_copter_key_pressed();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_copter_pen_up_hdlr
 * DESCRIPTION
 *  
 * PARAMETERS
 *  pos     [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_copter_pen_up_hdlr(mmi_pen_point_struct pos)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_gx_copter_key_released();
}

#endif /* __MMI_TOUCH_SCREEN__ */ 
/* MTK Leo end */

#endif /* IS_COPTER_BASE_GAME */ 

